Last active
April 26, 2016 20:26
-
-
Save jdcauley/e8a96ca044f0e83a844b22f447d50ee8 to your computer and use it in GitHub Desktop.
MatchBox.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($, undefined) { | |
$.fn.matchBox = function () { | |
var Boxes = this, | |
tallest = 0, | |
height; | |
Boxes.each(function(i){ | |
height = $(this).height(); | |
if(height > tallest){ | |
tallest = height; | |
} | |
}); | |
Boxes.height(tallest); | |
} | |
})(jQuery); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function matchBox(elements){ | |
var Boxes = elements, | |
tallest = 0, | |
height; | |
for(var i = 0, x = boxes.length; i < x; i++){ | |
} | |
Boxes.each(function(i){ | |
height = $(this).height(); | |
if(height > tallest){ | |
tallest = height; | |
} | |
}); | |
Boxes.height(tallest); | |
} | |
} | |
matchBox(document.getElementsByClassName('js-matchbox')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment