Move grid listeners to separate function
This commit is contained in:
parent
007cabe984
commit
7d45db79e2
1 changed files with 4 additions and 2 deletions
|
|
@ -26,7 +26,9 @@ function createGrid() {
|
|||
for (let i = 0; i < gridArea; i++){
|
||||
container.appendChild(grid.cloneNode(true));
|
||||
}
|
||||
}
|
||||
|
||||
function setGridListeners() {
|
||||
const gridItems = document.querySelectorAll(".grid");
|
||||
|
||||
gridItems.forEach((item) => {
|
||||
|
|
@ -36,7 +38,6 @@ function createGrid() {
|
|||
gridSlider.addEventListener("input", getGridDimensions);
|
||||
}
|
||||
|
||||
|
||||
function getGridDimensions() {
|
||||
numGrid = gridSlider.value;
|
||||
while (container.firstChild) {
|
||||
|
|
@ -86,4 +87,5 @@ function rgbColor() {
|
|||
|
||||
}
|
||||
|
||||
createGrid();
|
||||
createGrid();
|
||||
setGridListeners();
|
||||
Loading…
Reference in a new issue