I've been working on creating a modal that pops up after a short delay, but once closed, it shouldn't appear again unless the user closes the website and starts a new session. While I have successfully designed the modal, integrating sessionStorage has proven to be challenging.
<div id="myModal" class="modal">
<div class="modal-content">
<div class="modal-body">
<span class="close">×</span>
<h1>This is a Placeholder Body</h1>
</div>
</div>
</div>
<script>
var modal = document.getElementById("myModal");
var span = document.getElementsByClassName("close")[0];
span.onclick = function() {
modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
setTimeout(function(){
modal.style.display = "block";
},6000)
</script>