Skip to content

Instantly share code, notes, and snippets.

@erainey
Created September 29, 2012 18:06
Show Gist options
  • Save erainey/3804745 to your computer and use it in GitHub Desktop.
Save erainey/3804745 to your computer and use it in GitHub Desktop.
JavaScript: jQuery Equalize Columns
(function($){
/********EQUALIZE************/
$.fn.equalizeCols = function(){
var height = 0,
reset = $.browser.msie ? "1%" : "auto";
return this
.css("height", reset)
.each(function() {
height = Math.max(height, $(this).outerHeight(true));
})
.css("height", height)
.each(function() {
var h = $(this).outerHeight(true);
if (h > height) {
$(this).css("height", height - (h - height));
};
});
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment