32 lines
1.2 KiB
JavaScript
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';
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|