Created
November 11, 2014 19:37
-
-
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
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
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