match height js code example
Example: match height jquery
var matchHeight = function(classe, perLine) {
var peeps = $(String(classe)+":visible").css('height','auto').get();
var line = isNaN(perLine) ? peeps.length : parseInt(perLine);
for(var i = 0;i<peeps.length;i=i+line) {
var height = 0;
for(var x = i;x<(i+line);x++) {
if(peeps[x] && peeps[x].clientHeight > height) height = peeps[x].clientHeight;
}
for(var x = i;x<(i+line);x++) {
if(peeps[x]) peeps[x].style.height = String(height)+"px";
}
}
}
// matchHeight(".sameHeight", itemsPerLine) for per row matchHeight
// matchHeight(".sameHeight") to matchHeight across all elements