Created
November 15, 2012 14:33
-
-
Save hansspiess/4078911 to your computer and use it in GitHub Desktop.
Frontend: assign max or min Value to set of given elements
This file contains 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
/* set equal height on boxes */ | |
/* http://stackoverflow.com/questions/5052673/jquery-min-max-property-from-array-of-elements */ | |
Array.max = function( array ){ | |
return Math.max.apply( Math, array ); | |
}; | |
var heights = jQuery(".box").map(function() { | |
return jQuery(this).height(); | |
}).get(); | |
jQuery(".box").css("height", Array.max(heights)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment