Skip to content

Instantly share code, notes, and snippets.

@yoamomonstruos
Created November 10, 2012 14:44
Show Gist options
  • Save yoamomonstruos/4051297 to your computer and use it in GitHub Desktop.
Save yoamomonstruos/4051297 to your computer and use it in GitHub Desktop.
var DSB = {};
DSB.buildBoxes = function( count ) {
for( var _i = 0; _i < count; _i++ ) {
var el = document.getElementById("content");
var box = document.createElement("div");
box.classList.add("box");
el.appendChild(box);
}
};
DSB.setBoundaries = function() {
var el = document.getElementById("content");
DSB.boundaries = {
top: el.offsetTop,
left: el.offsetLeft,
bottom: el.offsetTop + el.clientHeight,
right: el.offsetLeft + el.clientWidth
};
return;
};
window.addEventListener("resize", function() {
DSB.setBoundaries();
});
document.addEventListener("DOMContentLoaded", function() {
DSB.buildBoxes(10);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment