2
I’m with a POPUP on my website that appears whenever the person updates or enters it.
I want to create a function javascript (for the page is in HTML and can not use PHP) so that the POPUP only once per user with an interval time, type 1 day for it to appear again.
I’m gonna drop my code:
<html>
<head>
<style>
#popup{
margin-top: -45px;
position: absolute;
width: 300px;
height: 250px;
left: 400px;
top: 288px;
z-index: 99999;
margin: -175px auto 0px 15px;
border: 6px solid rgba(0, 165, 71, 0.13);
padding: 10px;
padding-left: 30px;
padding-top: 30px;
background: rgba(255, 255, 255, 0.96);}
.fechar {position: absolute; top: -10px; right: -10px;}
</style>
</head>
<body>
<script src='http://ajax.googleap...2/jquery.min.js' type='text/javascript'/></script>
<div id='popup'>
<div class='fechar'>
<img src='http://jconlinedigit...e_fechar.png'/>
</div>
</div>
<script type='text/javascript'>
$(document).ready(function(){
$('.fechar').hover(function(event){
event.preventDefault();
$("#popup").hide();
});
});
setTimeout(function() {
$("#popup").css("display","block");
}, 5000);
</script>
</body>
</html>
Use the jquery-cookie, simply create a cookie, check if it exists, display the modal, if the user clicks to close, set the cookie to false.
– Bruno Wego