Created
May 15, 2013 01:16
-
-
Save norcross/5580993 to your computer and use it in GitHub Desktop.
set equal heights via JS
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 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