Skip to content

Instantly share code, notes, and snippets.

@roberocity
Created October 18, 2011 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roberocity/1295233 to your computer and use it in GitHub Desktop.
Save roberocity/1295233 to your computer and use it in GitHub Desktop.
jQuery plugin to equalize the height of several elements
(function($) {
$.fn.equalizeHeight = function(minHeight, maxHeight) {
tallest = (minHeight) ? minHeight : 0;
this.each(function() {
if($(this).height() > tallest) {
tallest = $(this).height();
}
});
if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
return this.each(function() {
$(this).height(tallest).css("overflow","auto");
});
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment