This is the final version of the repeating pattern I made. I kept it simple and used CSS elements to mimic the look of wooden windows sliding open and closed. Click on the windows!
Here is the code:
var min = 1;
var max = 4;
for ( var r = min; r <= max; r++ ) {
for ( var c = min; c <= max; c++ ) {
console.log( "column", c );
cgAddSquare(r,c);
}
}
function cgAddSquare( row, col ) {
var square = "";
var squareClass = "";
if ( ((row+col) % 2 ) == 0 ) {
squareClass = "window"
}
else if ( ((row+col) % 2 ) !== 0 ) {
squareClass = "windowbottom"
}
else {}
square = '';
document.write( square );
}
Here is an example of the pattern in action: