Skip to content

Instantly share code, notes, and snippets.

@dillansimmons
Last active October 19, 2016 16:19
Show Gist options
  • Save dillansimmons/96548356912764ca74c080c6ae7ff408 to your computer and use it in GitHub Desktop.
Save dillansimmons/96548356912764ca74c080c6ae7ff408 to your computer and use it in GitHub Desktop.
JQueryEqualHeight
// 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