Created
October 2, 2013 23:04
-
-
Save christianhanvey/6801848 to your computer and use it in GitHub Desktop.
Ye olde jQuery equal heights plugin
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
// jQuery plugin to create equal height elements | |
// Will make all elements that match the seletor the same height - matching the tallest of all of the elements. | |
// | |
// usage: | |
// $('.selector').equalHeights(); | |
(function ( $ ) { | |
$.fn.equalHeights = function(els) { | |
var maxHeight = 0; | |
this.each(function(){ | |
var elHeight = $(this).height(); | |
if (elHeight > maxHeight) { maxHeight = elHeight; } | |
}); | |
this.height(maxHeight); | |
return this; | |
}; | |
})( jQuery ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment