Created
September 6, 2013 13:57
-
-
Save sethrubenstein/6464187 to your computer and use it in GitHub Desktop.
Bootstrap looped item 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
$(document).ready(function(){ | |
var width = $(window).width(); | |
var height = $(window).height(); | |
var divs = $('.item'); | |
if (width >= 1200 ){ | |
for(var i = 0; i < divs.length; i+=4) { | |
divs.slice(i, i+4).wrapAll('<div class="row"></div>'); | |
} | |
} else if (width >= 992){ | |
for(var i = 0; i < divs.length; i+=3) { | |
divs.slice(i, i+3).wrapAll('<div class="row"></div>'); | |
} | |
} else { | |
for(var i = 0; i < divs.length; i+=2) { | |
divs.slice(i, i+2).wrapAll('<div class="row"></div>'); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment