Toddish / Popup

A barebones, flexible jQuery popup plugin. Designed for developers, it's simple to use but very powerful.
http://docs.toddish.co.uk/popup
MIT License
146 stars 78 forks source link

Set a time before showing a popup #28

Open HartLarsson opened 7 years ago

HartLarsson commented 7 years ago

I've tried this solution:

            var popup = new $.Popup();
            if ($.cookie('responsive_popup') == null) {
                var myVar = setTimeout(function(){ popup.open('#inline'); }, 3000);

            }
            $(".popup_close").click(function(){
                clearTimeout(myVar);
                $.cookie('responsive_popup', 'yes', { expires: {/literal}{$popup_cookie*0.000694}{literal}, path: '/' });
            });

The onkly problem is when i click the X to close the popup with setTimeout used, the cookie is not saved. If i remove the setTimeout function and return to the normal way is working.

Is very strange! There is a fix?