Created
April 22, 2014 18:18
-
-
Save sublimecoder/11189180 to your computer and use it in GitHub Desktop.
Equal Height Elements
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
// snippet requires jquery. | |
function equalHeight(group) { | |
tallest = 0; | |
// loop through and find the tallest div in a group. | |
group.each(function() { | |
thisHeight = jQuery(this).height(); | |
if(thisHeight > tallest) { | |
tallest = thisHeight; | |
} | |
}); | |
// finally set the group height equal to the tallest container. | |
group.height(tallest); | |
} | |
// lets grab a group of elements and pass them to the equalheight function | |
jQuery(document).ready(function() { | |
equalHeight(jQuery(".ClassSelector")); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment