design/public/assets/js/popups.js
free ko 42d8eab1f0
All checks were successful
publish / Build-and-publish (push) Successful in 19s
new pages, and various edits
2024-11-16 15:46:05 +02:00

32 lines
1.2 KiB
JavaScript

document.addEventListener('DOMContentLoaded', function() {
function setupPopup(triggerId, popupId) {
const trigger = document.getElementById(triggerId);
const popup = document.getElementById(popupId);
if (trigger && popup) {
trigger.addEventListener('click', function() {
popup.style.display = 'flex';
document.body.style.overflow = 'hidden';
});
}
}
// Setup popups
setupPopup('storePageInfoPopupTrigger', 'storePageInfoPopup');
setupPopup('mobileMenuPopupTrigger', 'mobileMenuPopup');
setupPopup('loginRegisterPopupTrigger', 'loginRegisterPopup');
setupPopup('loginRegisterMobilePopupTrigger', 'loginRegisterPopup');
setupPopup('userPageInfoPopupTrigger', 'userPageInfoPopup');// Add more as needed
// Close popups
document.querySelectorAll('.popupMainSecInsideBoxTopBtn').forEach(function(button) {
button.addEventListener('click', function() {
const popup = document.querySelector('.popupMain[style*="display: flex"]');
if (popup) {
popup.style.display = 'none';
document.body.style.overflow = 'auto';
}
});
});
});