Created
May 20, 2015 14:13
-
-
Save cyakimov/bc2b1cdb3c7eb1d0cd9b to your computer and use it in GitHub Desktop.
jQuery plugin for equal height elements
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.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