From ff051837ba8870d5ecb62ad28956a7fe3c3b61ec Mon Sep 17 00:00:00 2001 From: stitch Date: Fri, 26 Jul 2024 18:01:13 +0300 Subject: [PATCH] fixed a js issue with the login popup close button not working sometimes --- assets/js/popups.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/assets/js/popups.js b/assets/js/popups.js index 239eb19..617786a 100644 --- a/assets/js/popups.js +++ b/assets/js/popups.js @@ -8,7 +8,10 @@ document.getElementById('loginBtn').addEventListener('click', function() { // Function to handle popupMainInsideWrapperBoxTopBtn click document.addEventListener('click', function(event) { var clickedElement = event.target; - if (clickedElement.classList.contains('popupMainInsideWrapperBoxTopBtn')) { + var popupMainInsideWrapperBoxTopBtn = document.querySelector('.popupMainInsideWrapperBoxTopBtn'); + + // Check if the clicked element or its parent elements match the target + if (popupMainInsideWrapperBoxTopBtn.contains(clickedElement)) { var popupLogin = document.getElementById('popupLogin'); popupLogin.style.display = 'none'; document.body.style.overflow = ''; // Re-enable scroll