Skip to content

Instantly share code, notes, and snippets.

@hansspiess
Created November 15, 2012 14:33
Show Gist options
  • Save hansspiess/4078911 to your computer and use it in GitHub Desktop.
Save hansspiess/4078911 to your computer and use it in GitHub Desktop.
Frontend: assign max or min Value to set of given elements
/* 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