jQuery Make element heights consistent

A jQuery alternative to making element heights consistent with each other. This is useful when elements contain dynamic content, but are also aligned in the same vertical row.
// make element heights consistent
(function() {
	var maxHeight = 0;
	$('.box').each(function() {
		if ($(this).height() > maxHeight) {
			maxHeight = $(this).height();
		}
	});
	
	$('.box').each(function() {
		$(this).height(maxHeight);
	});
})();
Posted by
Snippet Viewed 1728 times.

Share your jQuery code snippets:

  • Get some recognition & a link back to your site.
  • Create your own code library.
  • Help your fellow developers, as they have helped you.

 

Submit | Browse

Most Recent jquery snippets

Most Viewed