From f8606755a8400a949d6b4a01aa1d7eab7d2e58ce Mon Sep 17 00:00:00 2001 From: eytorsousa Date: Tue, 16 Apr 2024 20:14:38 -0300 Subject: [PATCH] =?UTF-8?q?refatorando=20c=C3=B3digo:=20abrindo=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/scripts/index.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/assets/scripts/index.js b/assets/scripts/index.js index c5e20b1..5d3f746 100644 --- a/assets/scripts/index.js +++ b/assets/scripts/index.js @@ -8,7 +8,6 @@ const audio2 = new Audio('assets/media/reset.mp3'); const body = document.querySelector("body"); const bg2 = document.querySelector(".bg2"); -const bg1 = document.querySelector(".bg1"); const mode = document.querySelector(".mode"); const credits = document.querySelector("#credits"); const link = document.querySelector("#link"); @@ -101,28 +100,18 @@ function buttonContinue() { const settings = document.querySelector(".settings"); const back = document.querySelector(".back"); const menu = document.querySelector(".menu"); -const itens = document.getElementById("itens"); -const label = document.getElementById("label"); -const inputs = document.getElementById("inputs"); settings.addEventListener("click", openMenu); -back.addEventListener("click", closeMenu); +back.addEventListener("click", openMenu); function openMenu(){ - menu.classList.add("open"); - menu.classList.remove("closed"); -} - -function closeMenu(){ - menu.classList.add("closed"); - menu.classList.remove("open"); + menu.classList.toggle("open"); + menu.classList.toggle("closed"); } /* ---------------------------------------- Cores do Botão ----------------------------------------*/ - const colors = Array.from(document.querySelectorAll(".color")); - -console.log(colors); +const bg1 = document.querySelector(".bg1"); const presets = [ {