Skip to content

Instantly share code, notes, and snippets.

@edsilv
Last active August 29, 2015 14:02
Show Gist options
  • Save edsilv/6fc9b370d70df642cf01 to your computer and use it in GitHub Desktop.
Save edsilv/6fc9b370d70df642cf01 to your computer and use it in GitHub Desktop.
Equalise Element Heights
$.fn.equaliseHeight = function () {
var maxHeight = -1;
// reset all heights to auto first so they can be re-measured.
this.each(function () {
$(this).height('auto');
});
this.each(function () {
maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
});
this.each(function () {
$(this).height(maxHeight);
});
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment