This is a quick little function for making items of the smae class the same height, great for rows of items looking neat!


$(document).ready(function(){

// Select and loop the element items you want to be equal height
$('.item').each(function(){

// Cache the highest
var getHighest = 0;

// Select and loop the elements you want to be equal height
$('.item', this).each(function(){

// If this item is higher than the cached highest then store it away
if($(this).height() > getHighest) {
getHighest= $(this).height();
}

});

// Set the height of all those children to the hightest
$('.item',this).height(getHighest);

});

});

Leave a Reply