Skip to content

Instantly share code, notes, and snippets.

@thebigtine
Last active October 10, 2019 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebigtine/766ab42ab4ad6aadc7a89a80613984d4 to your computer and use it in GitHub Desktop.
Save thebigtine/766ab42ab4ad6aadc7a89a80613984d4 to your computer and use it in GitHub Desktop.
jQuery(document).ready(function($) {
let selector = $( '.selector' )
// Get an array of all element heights
var elementHeights = selector.map( function() {
return $( this ).height();
}).get()
// Math.max takes a variable number of arguments
// `apply` is equivalent to passing each height as an argument
var maxHeight = Math.max.apply( null, elementHeights )
// Set each height to the max height
selector.height( maxHeight )
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment