Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 在第三页打开fancybox_Jquery_Popup_Fancybox_Fancybox 3 - Fatal编程技术网

Jquery 在第三页打开fancybox

Jquery 在第三页打开fancybox,jquery,popup,fancybox,fancybox-3,Jquery,Popup,Fancybox,Fancybox 3,嗨,我在5秒后为新访客打开fancybox。我想打开弹出窗口不是在时间之后,而是在打开他访问的第三页(例如)之后。我怎样才能做到 我的超时解决方案如下所示: setTimeout(function () { $.fancybox({ autoSize: false, height: 'auto', minHeight: 300, width: '50%', href: '/index/some-page', type: 'iframe',

嗨,我在5秒后为新访客打开fancybox。我想打开弹出窗口不是在时间之后,而是在打开他访问的第三页(例如)之后。我怎样才能做到

我的超时解决方案如下所示:

setTimeout(function () {
  $.fancybox({
    autoSize: false,
    height: 'auto',
    minHeight: 300,
    width: '50%',
    href: '/index/some-page',
    type: 'iframe',
    afterLoad: function (current) {
      current.content.contents().find('.not-interest').click(function (e) {
        e.preventDefault();
        Cookies.set('not-interest', true, {expires: 14});
        $.fancybox.close();
      });
      current.content.contents().find('.some-form').submit(function () {
        var today = new Date();
        var date = new Date('Jan 1, 2038');
        var oneDay = 24 * 60 * 60 * 1000;
        var diffDays = Math.abs((date.getTime() - today.getTime()) / oneDay);
        Cookies.set('interest', true, {expires: diffDays});
      });
    },
    beforeClose: function () {
      Cookies.set('close', true, {expires: 14});
    }
  });
}, 5000);

我的想法是,统计用户的访问页面并将其保存到cookies中。这是个好办法?

是的,这是个好办法。好吧,我想如果不是更好的办法:)