开发者

jQuery .cookie with .delay?

开发者 https://www.devze.com 2023-01-20 20:32 出处:网络
I am trying to set a cookie with a delayed amount of time.开发者_运维问答 I want the cookie to be set after 80 minutes on the page.

I am trying to set a cookie with a delayed amount of time.

开发者_运维问答

I want the cookie to be set after 80 minutes on the page.

here is my code -

$(document).ready(function() {
            // Set the cookie after 81 mins so the next visit has the button
            $.cookie('EVGSalesLetter', 'visited').delay(4860000); 
        });


.delay() is for the animation queue, to just generally set a timer use setTimeout(), like this:

setTimeout(function() { $.cookie('EVGSalesLetter', 'visited'); }, 4860000);

I didn't stick this in a document.ready because I'm assuming (hopefully safely...) that ater 81 minutes your page has fully loaded :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号