Last active
October 10, 2019 14:07
-
-
Save thebigtine/766ab42ab4ad6aadc7a89a80613984d4 to your computer and use it in GitHub Desktop.
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
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