I have a modal which popups every time the page loads but how can I make it to not show again once user clicks on the close button?
Thanks in advance.
here is my modal code
<div class='modal' id='modal'>
<div class='content'>
<?php
//if (($now < $fromTime || $now >= $toTime) && ($now < $fromTime1 || $now >= $toTime1)){
?>
<span class="close" id='close'>×</span>
<?php
//}
?>
<div>
<a href="tel:<?php echo PHONE; ?>" onclick="return gtag_report_conversion('tel:<?php echo PHONE; ?>');" class="glow-on-hover">
<img src="images/popup.jpg" class="modalimg" alt="banner"></img>
</a>
</div>
</div>
</div>
and my jQuery
//Popup Modal
$(document).ready(function (){
$(".close").on("click", function (){
$("#modal").css("display", "none")
});
});
if(sessionStorage.getItem('#modal') !== 'true'){
$('#modal').css('display','block');
sessionStorage.setItem('#close','true');
}
My Answer:
't worry, I can help you with PHP. What do you need assistance with?
Rate this post
5 of 5 based on 9408 votesComments