// Wait for the page to fully load
document.addEventListener("DOMContentLoaded", function() {
// Check if the user has already visited
if (!localStorage.getItem("popupDisplayed")) {
// Delay execution by 5 seconds
setTimeout(function() {
// Display the modal
const modal = document.getElementById("popup-modal");
if (modal) {
modal.style.display = "flex";
}
// Mark that the pop-up has been shown
localStorage.setItem("popupDisplayed", "true");
}, 5000); // 5000ms = 5 seconds
}
});
// Close modal when clicking outside or on the close button
window.addEventListener("click", function(event) {
const modal = document.getElementById("popup-modal");
if (modal && event.target === modal) {
modal.style.display = "none";
}
});
document.addEventListener("click", function(event) {
if (event.target.id === "close-form") {
const modal = document.getElementById("popup-modal");
if (modal) {
modal.style.display = "none";
}
}
});