Hi I am looking for a jQuery based equal height columns. I know there are a lot of them floating around but my requirement is a bit different. I want to use these in a Mega Menu where thee are about 4-5 drop-downs and each drop-down has 3-4 columns.
I want all these 3-4 columns of equal height but not in all drop-downs, because the columns height will be different in the other drop-down depending on the content of that section.
I found a solution in MooTools which works perfect for my requirement. The MooTools code below makes all the columns in a particular div equal to it's parent div's height
The MooTools Code :
var Equalizer = new Class({ initialize: function(elements) { this.elements = $$(elements); }, equalize: function(hw) { if(!hw) { hw = 'height'; } var max = 0, prop = (typeof document.body.style.maxHeight != 'undefined' ? 'min-' : '') + hw; //ie6 ftl offset = 'offset' + hw.capitalize(); this.elements.each(function(element,i) { var calc = element[offset]; if(calc > max) { max = calc; } },this); this.elements.each(function(element,i) { element.setStyle(prop,max - (element[offset] - element.getStyle(hw).toInt())); }); return max; } }); Usage :
var columnizer = new Equalizer('.sizeMe').equalize('height'); //call .equalize() as often as you want! Can somebody help me converting this code in jQuery please. Actually my entire template is jQuery based and just for this equal-height function I do not want to load another JavaScript library.
Kindly Help!