Skip to content

Instantly share code, notes, and snippets.

@nathansmith
Created September 11, 2010 16:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathansmith/575325 to your computer and use it in GitHub Desktop.
Save nathansmith/575325 to your computer and use it in GitHub Desktop.
//
// Forces equal heights on a jQuery array.
//
equalize: function(jq_arr, min_height) {
if (!jq_arr.length) {
return;
}
function do_equalize() {
var tallest = min_height || 0;
jq_arr.each(function() {
this.style.height = '';
var this_height = $(this).height();
if (this_height > tallest) {
tallest = this_height;
}
}).css({
height: tallest
});
}
do_equalize();
$(window).load(function() {
do_equalize();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment