Skip to content

Instantly share code, notes, and snippets.

@norcross
Created May 15, 2013 01:16
Show Gist options
  • Save norcross/5580993 to your computer and use it in GitHub Desktop.
Save norcross/5580993 to your computer and use it in GitHub Desktop.
set equal heights via JS
//********************************************************
// function for calculating heights
//********************************************************
function equalHeight(group) {
var tallest = 0;
group.each(function() {
var thisHeight = jQuery(this).height();
if(thisHeight > tallest) {
tallest = thisHeight;
}
});
group.height(tallest);
}
// how to use
jQuery(document).ready( function($) {
$('div.MY-OUTER-CONTAINER').each(function() {
equalHeight($('DIV.THINGS-TO-EQUAL'));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment