Our Projection Services
×
if (lightbox && !lightbox.dataset.cgmListener) {
lightbox.addEventListener('click', (event) => {
if (event.target === lightbox) closeLightbox();
});
lightbox.dataset.cgmListener = 'true';
}
const handleEscapeKey = (event) => {
if (event.key !== 'Escape' && event.key !== 'Esc') return;
if (lightbox.classList.contains('is-open')) {
closeLightbox();
} else {
const openModal = document.querySelector('.cgm-modal.is-open');
if (openModal) closeModal(openModal);
}
};
window.removeEventListener('keydown', handleEscapeKey);
window.addEventListener('keydown', handleEscapeKey);
}
// Robust initialization for Squarespace 7.0
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', CgmGalleryInit);
} else {
CgmGalleryInit();
}
window.addEventListener('mercury:load', CgmGalleryInit);