Skip to content

Instantly share code, notes, and snippets.

Created July 8, 2016 07:32
What would you like to do?
JS - function to set the same height of items on a row
/* Set boxes height to match the highest box on the same row */
setBoxHeight: function(){
var boxes = $j('.myBoxes', this.$scope); //Selector and scope
var boxesByRow = 3; //Nb of items on a row
//Create each row
for(var i = 0; i < boxes.length; i+=boxesByRow) {
var newRow = boxes.slice(i, i+boxesByRow);
//Apply the highest "auto" box height to all the boxes of the row
function setHeight(row){
var autoHighest = 0;
var autoHeight = $j(this).css('height', 'auto').outerHeight();
if ( autoHeight > autoHighest ){
autoHighest = autoHeight;
var newHeight = autoHighest;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment