document.addEventListener('DOMContentLoaded', function() {
const popup = document.querySelector('.your-popup-class');
const closeIcon = document.querySelector('.popup-close-icon');
if (closeIcon) {
closeIcon.addEventListener('click', function(event) {
// Prevent any other actions
event.stopPropagation();
// Hide the popup by changing its display or visibility
const popup = this.closest('.your-popup-class');
if (popup) {
popup.style.display = 'none'; // or popup.classList.add('hidden');
}
});
}
// Prevent closing the popup when clicking on links or other interactive elements
if (popup) {
const links = popup.querySelectorAll('a');
links.forEach(link => {
link.addEventListener('click', function(event) {
event.stopPropagation();
});
});
}
});
document.addEventListener('DOMContentLoaded', function() {
const popup = document.querySelector('.your-popup-class');
const closeIcon = document.querySelector('.popup-close-icon');
if (closeIcon) {
closeIcon.addEventListener('click', function(event) {
// Prevent any other actions
event.stopPropagation();
// Hide the popup by changing its display or visibility
const popup = this.closest('.your-popup-class');
if (popup) {
popup.style.display = 'none'; // or popup.classList.add('hidden');
}
});
}
// Prevent closing the popup when clicking on links or other interactive elements
if (popup) {
const links = popup.querySelectorAll('a');
links.forEach(link => {
link.addEventListener('click', function(event) {
event.stopPropagation();
});
});
}
});