Skip to content

Instantly share code, notes, and snippets.

@ehynds
Created February 17, 2010 13:47
Show Gist options
  • Save ehynds/306617 to your computer and use it in GitHub Desktop.
Save ehynds/306617 to your computer and use it in GitHub Desktop.
// simple equal column heights
// sets the height of each matched div to that of the tallest element in the collection
// Usage: $("#div1, #div2, #div3").equalHeights();
$.fn.equalHeights = function(){
var heights = [], i = this.length;
while(i--){ heights[i] = this.eq(i).height(); }
return this.height(Math.max.apply(Math, heights));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment