Created
August 31, 2015 10:25
-
-
Save ghorvat/280702a4877da2123af9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function myFunction() { | |
var expTiles = jQuery('.category [class*="col-"]').not('.hidden'); | |
var tmpCount = 0; | |
var nextIsFirst = false; | |
var maxInRow; | |
maxInRow=12; | |
expTiles.each(function () { | |
var $this = jQuery(this); | |
var myColumns; | |
var elem; | |
if (nextIsFirst) { | |
$(this).addClass("first"); | |
nextIsFirst = false; | |
tmpCount = 0; | |
} | |
var numbers = []; | |
var string = this.className; | |
var regex = (/col-(xs|sm|md|lg)-(\d+)/g); | |
while (match = regex.exec(string)) { | |
numbers.push(match[2]); | |
} | |
for(i=0; i<numbers.length; i++){ | |
elem = numbers; | |
myColumns = numbers[i]; | |
console.log(numbers); | |
var myColumns2 = parseInt(myColumns); | |
} | |
tmpCount +=myColumns2; | |
//console.log(tmpCount); | |
if (tmpCount >= maxInRow) { | |
nextIsFirst = true; | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment