This .popup-overlay-b
container is set to "display: none" in CSS but has a javascript code forcing it to show if there's no previous cookie session and it's supposed to expire after 1 day. I just need to give it a few seconds delay before it shows.
This code works without the delay
$(document).ready(function(){
if (!Cookies.get('alert')) {
$('.popup-overlay-b').show();
Cookies.set('alert', true, { expires: 1 });
}
});
</script>
This is what I've attempted and doesn't work
$(document).setTimeout(function(){
if (!Cookies.get('alert')) {
$('.popup-overlay-b').show();
Cookies.set('alert', true, { expires: 1 });
}
},3000);
</script>
CodePudding user response:
You can use the await sleep(<duration>);
CodePudding user response:
$(document).ready(() => {
setTimeout(() => {
if (!Cookies.get('alert')) {
$('.popup-overlay-b').show();
Cookies.set('alert', true, { expires: 1});
}
}, 3000);
});