Skip to content

Instantly share code, notes, and snippets.

@sublimecoder
Created April 22, 2014 18:18
Show Gist options
  • Save sublimecoder/11189180 to your computer and use it in GitHub Desktop.
Save sublimecoder/11189180 to your computer and use it in GitHub Desktop.
Equal Height Elements
// 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