jQuery equal height columns

Sometimes equal height columns via css can be an absolute nightmare! If you’re using jQuery for other items on the page you can cheat with the following function :

function setEqualHeight(items) { 
var highest = 0; 
items.each( function(){ 
current = $(this).height(); 
if(current > highest){ 
highest = current; 
} 
}); 
items.height(highest); 
};

It just loops the the passed in items, gets the largest one and sets the smaller items to its height.

Leave a Reply

Your email address will not be published. Required fields are marked *