diff --git a/index.html b/index.html
index 26c90b5..db62a34 100644
--- a/index.html
+++ b/index.html
@@ -8,7 +8,13 @@
+
+
+
+
diff --git a/script.js b/script.js
index a30685e..554cc8a 100644
--- a/script.js
+++ b/script.js
@@ -4,6 +4,8 @@ const container = document.querySelector(".container");
const conWidth = container.clientWidth;
const conHeight = container.clientHeight
const grid = document.createElement("div");
+const gridSlider = document.querySelector("#gridSlider");
+
function createGrid() {
const gridArea = numGrid ** 2;
@@ -24,13 +26,22 @@ function createGrid() {
item.addEventListener("mouseover", colorGrid);
});
+ gridSlider.addEventListener("change", getGridDimensions);
+
+}
+
+
+function getGridDimensions() {
+ numGrid = gridSlider.value;
+ while (container.firstChild) {
+ container.removeChild(container.lastChild);
+ }
+ console.log(numGrid);
+ createGrid();
}
function colorGrid() {
this.style.background = "blue";
}
-
-createGrid();
-
-
+createGrid();
\ No newline at end of file
diff --git a/style.css b/style.css
index 897865d..5988dea 100644
--- a/style.css
+++ b/style.css
@@ -4,6 +4,7 @@ body{
}
.area{
display: flex;
+ flex-direction: column;
justify-content: center;
align-items: center;
height: 90vh;
@@ -19,4 +20,6 @@ body{
.grid {
border: 1px solid #bbb;
box-sizing: border-box;
+ min-height: 0;
+ overflow: hidden;
}
\ No newline at end of file