6
A friend passed me a script of a box that opens when someone enters the site, however, when updating the page it appears again. You could help me?
Below the code:
function timer() {
jQuery('.cloudbanner').hover(function () {
jQuery('#follow').css('display', 'block');
cronometro();
});
jQuery('.closeads').hover(function () {
jQuery('#follow').css('display', 'block');
cronometro();
});
}
function cronometro() {
setTimeout('amostra()', 3000);
}
function amostra() {
jQuery('.cloudbanner').css('display', 'none');
jQuery('#follow').css('display', 'none');
jQuery('#fr').removeAttr('src');
}
function excludeDiv() {
jQuery('#close').css('display', 'none');
jQuery('.closeads').css('display', 'block');
timer();
}
var numero = 5;
function chamar() {
if (numero > 0) {
document.getElementById('timers').innerHTML = --numero;
}
}
setInterval("chamar();", 900);
setTimeout("excludeDiv();", 10000);
I imagine it has to do with cookie and I should create one, but I don’t know how to.
Do you want him to run once and never refresh the page? That’s it?
– Sergio
Is using PHP?
– Dirty Old Man
I’m using it in Wordpress, in the header (index.php). What I wanted is for it to appear only once a day.
– Hugo Leonardo
I suggest the quick and easy
sessionStorage
. Saves variables while running the Browser. When you close the Browser variables are cleared.– Guill