Skip to content

Instantly share code, notes, and snippets.

@christianhanvey
Created October 2, 2013 23:04
Show Gist options
  • Save christianhanvey/6801848 to your computer and use it in GitHub Desktop.
Save christianhanvey/6801848 to your computer and use it in GitHub Desktop.
Ye olde jQuery equal heights plugin
// 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