Created
June 21, 2016 12:30
-
-
Save artygrand/fd6b8dadf69cb1dacb49c65d113aef1e to your computer and use it in GitHub Desktop.
Equal heights for catalog grid
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
Object.defineProperty(Array.prototype, 'chunk', {value: function(n) { | |
return Array.from(Array(Math.ceil(this.length/n)), (_,i)=>this.slice(i*n,i*n+n)); | |
}}); | |
$(window).load(function(){ | |
$.each($('.hit-info a').toArray().chunk(4), function(index, els) { | |
var maxheight = 0; | |
$(els).each(function(){ | |
var height = $(this).outerHeight() | |
if(height > maxheight) { | |
maxheight = height; | |
} | |
}).css('min-height', maxheight); | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment