Last active
August 29, 2015 14:01
-
-
Save jaggy/abf656d6423c0d0ee7bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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