I am trying to implement a subscription box that activates the first time you visit the website.
At the moment the subscription modal doesnt load when you first visit the site and I can’t figure out why?
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).load(function(){
// load the overlay
if (document.cookie.indexOf('visited=true') == -1) {
var fifteenDays = 1000*60*60*24*15;
var expires = new Date((new Date()).valueOf() + fifteenDays);
document.cookie = "visited=true;expires=" + expires.toUTCString();
jQuery.modal({width:"580px", inline:true, href:"#myModal"});
}
});
</script>
I can load the modal by click a link but I need to automatically popup when a user first visits. Can anyone see what is wrong with my code?
First you’re referring to:
And later you are referring to:
Is it a class or an id? Probably that is your mistake.
On a side-note, you may wish to specify the language-attribute on your script tag.