Get Max Height Widget

Javascript

by Zuhaib Siddiqui

HTML

<div class="features a"> JKJ LKJLK JLK JLKJ LKJ LK JLK JJKJ LKJLK JLK JLKJ LKJ LK JLK JJKJ LKJLK JLK JLKJ LKJ LK JLK JJKJ LKJLK JLK JLKJ LKJ LK JLK J</div>
<div class="features b"></div>
<div class="features c"></div>

CSS

.a { background-color: red; }
.b { background-color: aqua; }
.c { background-color: blue; }

JavaScript

$(document).ready(function() {
    var maxHeight = -1;

    $('.features').each(function() {
      maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
    });

    $('.features').each(function() {
      $(this).height(maxHeight);
    });
});