Skip to content

Instantly share code, notes, and snippets.

@jaggy
Last active August 29, 2015 14:01
Show Gist options
  • Save jaggy/abf656d6423c0d0ee7bb to your computer and use it in GitHub Desktop.
Save jaggy/abf656d6423c0d0ee7bb to your computer and use it in GitHub Desktop.
$.fn.equalize = function(options)
{
var self = this;
function equalize () {
var elements = $(self);
// calculate the max height
var maxHeight = Math.max.apply(null, elements.map(function () {
return $(this).height();
}).get());
elements.each(function (index, dom) {
var $elem = $(dom);
$elem.css('height', maxHeight);
});
}
equalize();
$(window).resize(equalize);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment