Skip to content

Instantly share code, notes, and snippets.

@timsnadden
Created August 6, 2010 01:42
Show Gist options
  • Save timsnadden/510695 to your computer and use it in GitHub Desktop.
Save timsnadden/510695 to your computer and use it in GitHub Desktop.
jquery equal heights
$.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