Last active
October 22, 2015 18:43
-
-
Save rbk/9c01f2347f7cc9fa1ab9 to your computer and use it in GitHub Desktop.
Equalize the heights of a set of elements
This file contains 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
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