jQuery script – Equal height div

I came across a problem which I want  to set my div height equal.  This script will calculate the maximum height from the set of elements and apply max height to each div which has same class.



$.fn.sameHeights = function() {
var tallest = 0;
if (tallest < $(this).height()) { tallest = $(this).height(); }
$(this).children().css({'height': tallest});
return this;
//* Call your function */
Share this nice post: