jQuery .cookie with .delay?
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 :)
精彩评论