Skip to content

Instantly share code, notes, and snippets.

@KnightAlex
Created July 8, 2014 10:17
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 KnightAlex/8870374ff1f2b3e22d37 to your computer and use it in GitHub Desktop.
Save KnightAlex/8870374ff1f2b3e22d37 to your computer and use it in GitHub Desktop.
Equal height html elements (jQuery)
// Match heights of elements on homepage for uniform display
matchHeight = function() {
//Timeout added to counteract delays in element sizing from loading
setTimeout(function(){
jQuery('.equal').each(function(){
var maxHeight = '0';
jQuery('.equal').each(function(){
maxHeight = (jQuery(this).height() > maxHeight) ? jQuery(this).height() : maxHeight;
});
jQuery('.equal').height(maxHeight);
});
}, 500);
}
jQuery(function (){
matchHeight();
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment