Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
jQuery function to equalize heights of a set of elements. HTML structure for example call: div.equalize>div*4
$(window).on('load resize', function(){
$('.equalize > *').equalHeights();
});
$.fn.equalHeights = function() {
var maxHeight = 0,
$this = $(this);
$this.each( function() {
$(this).css('min-height', 'none');
var height = $(this).outerHeight();
if ( height > maxHeight ) { maxHeight = height; }
});
return $this.css('min-height', maxHeight);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment