Skip to content

Instantly share code, notes, and snippets.

@ideiasfrescas
Created January 12, 2021 16:03
Show Gist options
  • Save ideiasfrescas/b3f967d36970b6fe9c6de3779c0b4d9b to your computer and use it in GitHub Desktop.
Save ideiasfrescas/b3f967d36970b6fe9c6de3779c0b4d9b to your computer and use it in GitHub Desktop.
matchheight caseiro
/* author @dactyllo */
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";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment