Created
April 2, 2015 21:07
-
-
Save anikets/29f58ce0be09a5db95a7 to your computer and use it in GitHub Desktop.
A function to equalize heights of all elements matching the selector.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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