Skip to content

Instantly share code, notes, and snippets.

@anikets
Created April 2, 2015 21:07
Show Gist options
  • Save anikets/29f58ce0be09a5db95a7 to your computer and use it in GitHub Desktop.
Save anikets/29f58ce0be09a5db95a7 to your computer and use it in GitHub Desktop.
A function to equalize heights of all elements matching the selector.
// A function to equalize heights of all elements matching the selector.
// Example Usage:
// equalizeHeights( '.allTestimonialTextBlocks' );
function equalizeHeights( selector ) {
var max = 0;
var current;
$( selector ).css( 'min-height', 'inherit' );
$( selector ).each( function( i, v ) {
current = parseInt( $( v ).css( 'height' ));
current > max ? max = current : max = max;
});
$( selector ).css( 'min-height', max );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment