Skip to content

Commit

Permalink
Create script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
20240906book authored Sep 9, 2024
1 parent 2b9cf28 commit 8030dbf
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const boxesContainer = document.getElementById('boxes')
const btn = document.getElementById('btn')

btn.addEventListener('click', () => boxesContainer.classList.toggle('big'))

function createBoxes() {
for (let i = 0; i < 4; i++) {
for (let j = 0; j < 4; j++) {
const box = document.createElement('div')
box.classList.add('box')
box.style.backgroundPosition = `${-j * 125}px ${-i * 125}px`
boxesContainer.appendChild(box)
}
}
}

createBoxes()

0 comments on commit 8030dbf

Please sign in to comment.