I’ve added a small javascript that opens a lightbox pop-up window when you visit a home page of a website.
And I’ve added a cookie to prevent the pop-up from reoccurring. The lightbox will open the next “session” of the browser. (quit out of the browser, reopen it, and the lightbox pop-up appears again) That’s good, but I’d like to add a timer to it as well. So if you don’t quit the browser, but revisit the home page after a certain time, the lightbox will appear again – then go away for a time again.
It’s a specific function, we want for the website, but although I’ve found a few possible solutions, but I’m not a skilled enough Javascripter to know if they aren’t compatible, or if I’m entering the syntax incorrectly. I’m sure it’s probably the later.
I’m sure there’s probably a simple solution, but I need a little help.
This is the script:
[CODE] <script>
if (document.cookie.indexOf(“fade=”) == -1) {
var now = new Date();
document.cookie = “fade=yes”;
$(document).ready(function () {
$(‘#fade’).popup({
transition: ‘all 0.5s’,
autoopen: true,
scrolllock: true
});
});
}
</script>
If anyone can either let me know how to add the extra cookie, or point me in the right direction, I’d appreciate it. Thanks.