jQuery - Equal height columns
William McKeehan
William McKeehan
February 3, 2022

jQuery - Equal height columns

jQuery - Equal height columns

When you’re using columns to display content on your site, it definitely look better if the columns have an equal height. The code below will take all div elements with the .col class and will adjust their heights according to the bigger element. Super useful!

Copy
var maxheight = 0;
$("div.col").each(function(){
    if($(this).height() > maxheight) { maxheight = $(this).height(); }
    });
$("div.col").height(maxheight);

Source: [http://web.enavu.com/tutorials/top-10-jquery-snippets-including-jquery-1-4/