Skip to content

Instantly share code, notes, and snippets.

@graybill
Created May 6, 2010 23:46
Show Gist options
  • Save graybill/392836 to your computer and use it in GitHub Desktop.
Save graybill/392836 to your computer and use it in GitHub Desktop.
function makeSomeRows () {
var columns, i, tmpCols;
tmpCols = new Array();
columns = $(".column"); // jQuery collection of all the columns
i = 0; // counter
columns.each(function(){
tmpCols.push(this); // wrap four columns in a row
i++;
if (i > 3) { // reset loop
$(tmpCols).wrapAll("<div class=\"row\" />");
i = 0; // reset i to 0
tmpCols = []; // empty tmpCols array
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment