jQuery秒表

jQuery秒表,jquery,cookies,stopwatch,Jquery,Cookies,Stopwatch,我正在使用秒表插件,我希望能够将秒表值保存到cookie中,但我不知道如何做到这一点?基本上,我希望在2分钟后在我的网站上出现一个弹出窗口,无论他们是否正在查看网站的不同页面,因此用户一进入网站,cookie就开始计数,他们可能在主页上,然后进入“关于我们”页面,但秒表cookie在后台最多计数2分钟,我目前有: var timer = $('#test').stopwatch().stopwatch('start'); // I need this to go in to the cookie

我正在使用秒表插件,我希望能够将秒表值保存到cookie中,但我不知道如何做到这一点?基本上,我希望在2分钟后在我的网站上出现一个弹出窗口,无论他们是否正在查看网站的不同页面,因此用户一进入网站,cookie就开始计数,他们可能在主页上,然后进入“关于我们”页面,但秒表cookie在后台最多计数2分钟,我目前有:

var timer = $('#test').stopwatch().stopwatch('start');
// I need this to go in to the cookie below...

$.cookie('popuptimer', 'timer', { expires: null });

if($.cookie('popuptimer') == 1000*60*2){
   $.fancybox({
      overlayOpacity: 0.8,
      overlayColor: '#000',
      type: 'iframe',
      width: 625,
      height: 550,
      overflow: 'auto',
      padding: 0,
      href: '<?php echo base_url(); ?>feedback'
   });
}
var timer=$('#test').stopwatch().stopwatch('start');
//我需要把这个放到下面的饼干里。。。
$.cookie('PopupTime','timer',{expires:null});
如果($.cookie('popupper')==1000*60*2){
$.fancybox({
超产能:0.8,
套色:'#000',
键入:“iframe”,
宽度:625,
身高:550,
溢出:“自动”,
填充:0,
href:“反馈”
});
}

我不太明白您到底想做什么,但要用
$保存一个值。cookie
您应该做什么

var timer = $('#test').stopwatch().stopwatch('start');
// I need this to go in to the cookie below...

$.cookie('popuptimer', timer);
然后你就可以像你一样找回它

var timer = $.cookie('popuptimer');
当然,这假定计时器是一个数字/字符串,而不是一个对象