Skip to content

Instantly share code, notes, and snippets.

@natejacobson
Last active August 29, 2015 13:56
Show Gist options
  • Save natejacobson/8969689 to your computer and use it in GitHub Desktop.
Save natejacobson/8969689 to your computer and use it in GitHub Desktop.
A Column Equalizer
$(document).ready(function(){
function equalizing() {
if( $('.equalize').length ) {
$('.row.equalize .column').css('min-height','');
$('.row.equalize').each(function(){
var tallestBox = 0;
$('.column', this).each(function(){
if($(this).height() > tallestBox) {
tallestBox = $(this).outerHeight();
}
});
$('.column',this).not('.unequaled').css('min-height',tallestBox);
$('section.equalize .column',this).css('min-height','auto');
});
}
}
equalizing();
$(window).resize(function(){ equalizing(); });
});
@natejacobson
Copy link
Author

This is probably the first piece of Javascript I've tweaked to the point that I think others could benefit from my contribution, so here you go. See http://jsfiddle.net/nathanbjacobson/6GwXA/1/. It started here http://stackoverflow.com/questions/11688250/setting-equal-heights-for-divs-with-jquery/11688385#11688385.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment