Created
August 6, 2010 01:42
-
-
Save timsnadden/510695 to your computer and use it in GitHub Desktop.
jquery equal heights
This file contains 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
$.fn.equalHeights = function() { | |
/* Create an array of element heights */ | |
var heights = this.map(function() { | |
return $(this).height(); | |
}).get(); | |
/* Find the tallest */ | |
var max = Math.max.apply(null, heights); | |
/* Set all elements to be equal height */ | |
return this.each(function() { | |
$(this).height(max); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment