Skip to content

Instantly share code, notes, and snippets.

@cyakimov
Created May 20, 2015 14:13
Show Gist options
  • Save cyakimov/bc2b1cdb3c7eb1d0cd9b to your computer and use it in GitHub Desktop.
Save cyakimov/bc2b1cdb3c7eb1d0cd9b to your computer and use it in GitHub Desktop.
jQuery plugin for equal height elements
$.fn.setSameHeight = function () {
var arrHeights = this.map(function (i, el) {
return $(el).height();
});
var maxHeight = Math.max.apply(null, arrHeights);
this.height(maxHeight);
return this;
};
//Usage:
//$('.element1, .element2').setSameHeight();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment