Last active
October 19, 2016 16:19
-
-
Save dillansimmons/96548356912764ca74c080c6ae7ff408 to your computer and use it in GitHub Desktop.
JQueryEqualHeight
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
// Equal height function (finds tallest of all and matches) takes class/id/html-element | |
var equal_height = function equalheight(element) { | |
maxheight=0; | |
// Find Tallest of elements | |
$(element).each(function(){ | |
maxheight = $(this).height() > maxheight ? $(this).height() : maxheight; | |
}) | |
// Make all elements the same height. | |
$(element).height(maxheight); | |
}; | |
//Make all elements with "sample" class the same height. | |
equal_height('.sample'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment