Add grid
This commit is contained in:
parent
08272480e2
commit
85ef7a2709
2 changed files with 16 additions and 1 deletions
11
script.js
11
script.js
|
|
@ -3,5 +3,14 @@ const conWidth = container.clientWidth;
|
|||
const conHeight = container.clientHeight
|
||||
const grid = document.createElement("div");
|
||||
let numGrid = 16;
|
||||
const gridArea = numGrid ** 2;
|
||||
const gridWidth = conWidth / numGrid;
|
||||
const gridHeight = conHeight / numGrid;
|
||||
const gridHeight = conHeight / numGrid;
|
||||
|
||||
grid.classList.add("grid");
|
||||
grid.style.width = gridWidth + 'px';
|
||||
grid.style.height = gridHeight + 'px';
|
||||
|
||||
for (let i = 0; i < gridArea-1; i++){
|
||||
container.appendChild(grid.cloneNode(true));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue