From 040e8a0301a57f7e0c5c40275df62c0120998172 Mon Sep 17 00:00:00 2001 From: Keep Creating Online <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sat, 1 Feb 2025 19:59:40 -0500 Subject: [PATCH] improved modal exit on mobile --- src/index.html | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/index.html b/src/index.html index 9d81fb3..1f03f2b 100644 --- a/src/index.html +++ b/src/index.html @@ -345,12 +345,18 @@ // Just load the login modal (or any others), without adding event listeners here. // The logic to open/close the modal is all in app.js now. - Promise.all([ - loadModal("components/login-modal.html"), - // e.g. loadModal("components/upload-modal.html"), - // loadModal("components/profile-modal.html"), - ]).then(() => { + Promise.all([loadModal("components/login-modal.html")]).then(() => { console.log("Modals loaded (login-modal.html, etc.)"); + // Now that the login-modal is definitely in the DOM: + const closeBtn = document.getElementById("closeLoginModal"); + if (closeBtn) { + closeBtn.addEventListener("click", () => { + const loginModal = document.getElementById("loginModal"); + if (loginModal) { + loginModal.classList.add("hidden"); + } + }); + } });