Skip to content

Instantly share code, notes, and snippets.

@rbk
Last active October 22, 2015 18:43
Show Gist options
  • Save rbk/9c01f2347f7cc9fa1ab9 to your computer and use it in GitHub Desktop.
Save rbk/9c01f2347f7cc9fa1ab9 to your computer and use it in GitHub Desktop.
Equalize the heights of a set of elements
jQuery.fn.equalize = function( ){
var tallest = 0;
jQuery(this).each(function(){
if( jQuery(this).height() > tallest ){
tallest = jQuery(this).height();
}
});
if( jQuery(window).width() > 992 ){
jQuery(this).css('height',tallest + 'px');
} else {
jQuery(this).css('height', 'auto');
}
}
// Example usage: $('.event').equalize();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment