From 7a4baecca1e3e3e0ec5d9de087e4f11123cab85a Mon Sep 17 00:00:00 2001 From: h-khribich Date: Sat, 19 Jun 2021 18:18:50 +0200 Subject: [PATCH] Fermeture de la modale https://github.com/OpenClassrooms-Student-Center/GameOn-website-FR/issues/1 --- starterOnly/modal.js | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/starterOnly/modal.js b/starterOnly/modal.js index 49b2a8712d..47a1020a67 100644 --- a/starterOnly/modal.js +++ b/starterOnly/modal.js @@ -11,7 +11,7 @@ function editNav() { const modalbg = document.querySelector(".bground"); const modalBtn = document.querySelectorAll(".modal-btn"); const formData = document.querySelectorAll(".formData"); -const modalClosebtn = document.querySelector(".close"); +const modalClosebtn = document.querySelector(".content > .close"); // Launch modal event modalBtn.forEach((btn) => btn.addEventListener("click", launchModal)); @@ -20,26 +20,13 @@ modalBtn.forEach((btn) => btn.addEventListener("click", launchModal)); function launchModal() { modalbg.style.display = "block"; }; -/* -//Array.from(modalClosebtn).forEach((btn) => btn.addEventListener("click", closeModal)); -console.log(modalClosebtn); - -// Close modal form -modalCloseBtn.addEventListener("click", closeModal()); - -function closeModal() { +// Close modal event and form +modalClosebtn.addEventListener("click", function() { modalbg.style.display = "none"; -}; +}); -console.log(modalClosebtn); -/* -modalCloseBtn.forEach((btn) => btn.addEventListener("click", closeModal)); - -function closeModal() { - modalbg.style.display = "none"; -}; -*/ +//validate()