Skip to content

Instantly share code, notes, and snippets.

@andyford
Created April 12, 2011 07:14
Show Gist options
  • Save andyford/915094 to your computer and use it in GitHub Desktop.
Save andyford/915094 to your computer and use it in GitHub Desktop.
equalHeights jQuery Plugin
/*!
* equalHeights jQuery Plugin
*/
(function($){
$.fn.equalHeights = function() {
var tallest = 0,
current = 0;
this.each(function(){
current = $(this).height();
if(current > tallest) {
tallest = current;
}
});
return this.height(tallest);
};
})(jQuery);
@andyford
Copy link
Author

Use on any collection:
$('div.grid > div.box').equalHeights();
$('.whatever').equalHeights();
etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment