Skip to content

Instantly share code, notes, and snippets.

@drichar
Created November 11, 2014 19:37
Show Gist options
  • Save drichar/268abcc4cb3dc97054f0 to your computer and use it in GitHub Desktop.
Save drichar/268abcc4cb3dc97054f0 to your computer and use it in GitHub Desktop.
Compares the outerHeight (height including borders and padding, if any) of all DOM elements with the class name provided as argument, then takes the height of the tallest element and applies it to the others
function eqHeight(className) {
var elements = $("." + className),
targetHeight = 0;
elements.each(function(i){
if ($(this).outerHeight() > targetHeight) {
targetHeight = $(this).outerHeight();
}
});
elements.css({'min-height': targetHeight});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment