Computer Magic Logo
Elements with equal height

Friday, January 22, 2016

Published by Aristotelis Pitaridis

The code below allow us to change the height of a group of elements so that it will be equal to the height of the element with the greater height.

var MaxHeight = 0;
$(".MyClass").each(function(){
    if ($(this).height() > Maxheight)
    {
        MaxHeight = $(this).height();
    }
});

$(".MyClass").height(MaxHeight);