jQuery Set Equal Heights
jQuery plugin to set elements to the same height
by zeroskillz
HTML
<div class="a">a</div>
<div class="b">b</div>
<div class="c">c</div>
CSS
div{
background:#cccccc;
margin:10px;
}
.a{
height:20px;
}
.b{
height:30px;
}
.c{
height:40px;
}
JavaScript
(function ($) {
$.fn.setEqualHeights = function () {
var h = 0;
this.each(function () {
var eH = $(this).height();
if (eH > h) {h = eH}
});
return this.each(function () {
$(this).height(h);
});
};
}(jQuery));
$(document).ready(function(){
$('div').setEqualHeights();
});