JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<div class="container">
<div class="row">
<div class="col-xs-4 js-equal-height">
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
</div>
<div class="col-xs-4 js-equal-height">
<p>test</p>
<p>test</p>
</div>
<div class="col-xs-4 js-equal-height">
<p>test</p>
</div>
</div>
</div>
CSS
.js-equal-height {
border: solid 1px red;
}
JavaScript
var equalHeights = {
elementsArray: [],
elements : '',
init: function($) {
"use strict";
var elementsArray = [];
this.elements = $('.js-equal-height');
// reset the heights of all the selected elements
this.elements.each(function() {
// add each element to the array.
elementsArray.push($(this));
});
this.elementsArray = elementsArray;
this.execute($);
},
execute: function($) {
if (equalHeights.elements.length) {
var count = 0,
el,
iPosition,
elPosition,
elHeight,
iHeight,
elementsArray = equalHeights.elementsArray,
elements = equalHeights.elements;
elements.height('auto');
for (var i=0, x = elementsArray.length; i<x; i++) {
for (var j=0, k = elementsArray.length; j<k; j++) {
var el = elementsArray[j];
iPosition = elementsArray[i].offset().top;
elPosition = el.offset().top;
// grab the top positions of the elements
if (count !== i) {
// check it's not the current item
if (iPosition === elPosition) {
// two elements are in the same vertical position.
iHeight = elementsArray[i].outerHeight();
// set the heights equal to the tallest.
elHeight = el.outerHeight();
if (iHeight >= elHeight) {
el.css({'height' : iHeight});
}
}
}
count ++;
}
}
}
}
};
equalHeights.init(jQuery);