fixed a js issue with the login popup close button not working sometimes

This commit is contained in:
stitch 2024-07-26 18:01:13 +03:00
parent 8dda7b116a
commit ff051837ba

View File

@ -8,7 +8,10 @@ document.getElementById('loginBtn').addEventListener('click', function() {
// Function to handle popupMainInsideWrapperBoxTopBtn click // Function to handle popupMainInsideWrapperBoxTopBtn click
document.addEventListener('click', function(event) { document.addEventListener('click', function(event) {
var clickedElement = event.target; 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'); var popupLogin = document.getElementById('popupLogin');
popupLogin.style.display = 'none'; popupLogin.style.display = 'none';
document.body.style.overflow = ''; // Re-enable scroll document.body.style.overflow = ''; // Re-enable scroll