Created
January 12, 2021 16:03
-
-
Save ideiasfrescas/b3f967d36970b6fe9c6de3779c0b4d9b to your computer and use it in GitHub Desktop.
matchheight caseiro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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