click here for popup
<div id="myPopup" class="popup">
<!-- Your pop-up content here -->
<p>This is a test pop-up!</p>
<button onclick="hidePopup()">Close</button>
</div>
.popup {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
display: none; /* Initially hidden */
z-index: 1000; /* Ensure it appears above other content */
}
.popup-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: white;
padding: 20px;
border-radius: 5px;
}
function showPopup() {
document.getElementById('myPopup').style.display = 'block';
}
function hidePopup() {
document.getElementById('myPopup').style.display = 'none';
}
function showPopupAfterDelay() {
setTimeout(showPopup, 5000); // Show after 5 seconds (adjust as needed)
}
showPopupAfterDelay(); // Start the timer
function showPopupAfterDelayAndHide() {
setTimeout(showPopup, 5000); // Show after 5 seconds (adjust as needed)
setTimeout(hidePopup, 10000); // Hide after 10 seconds (adjust as needed)
}
showPopupAfterDelayAndHide(); // Start the timer
Leave a Reply