Skip to content

Instantly share code, notes, and snippets.

@duncanmcdougall
Created January 15, 2013 14:21
Show Gist options
  • Save duncanmcdougall/4538994 to your computer and use it in GitHub Desktop.
Save duncanmcdougall/4538994 to your computer and use it in GitHub Desktop.
Very simple match heights function. Sets all elements height to the largest of its kind.
function matchHeights(selector) {
$(selector).height('');
var maxHeight = 0;
$(selector).each(function (idx, item) {
if ($(item).outerHeight() > maxHeight) {
maxHeight = $(item).outerHeight();
}
});
if (maxHeight > 0) {
$(selector).outerHeight(maxHeight);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment