Share This
jQuery(document).ready(function($) { function equalizeHeight() { var tallestHeight = 0; // Ensure all elements are set to auto first to get the correct height $(".rest").css("height", "auto"); // Get the height of the tallest element $(".tallest").each(function() { var currentHeight = $(this).outerHeight(); if (currentHeight > tallestHeight) { tallestHeight = currentHeight; } }); // Apply the height to all elements with the class "rest" $(".rest").each(function() { $(this).css("height", tallestHeight); }); } // Run on page load $(window).on("load", function() { equalizeHeight(); }); // Run again if the window resizes $(window).resize(function() { equalizeHeight(); }); // Run again if images are loaded dynamically $("img").on("load", function() { equalizeHeight(); }); });