【发布时间】:2018-12-24 15:18:40
【问题描述】:
我正在寻找一种使用 Jquery 延迟弹出窗口的方法
嗨,
我不擅长 Jquery,所以我一直在寻找一种方法来延迟我的弹出窗口几秒钟,然后再弹出。 Jquery 现在正在使用 cookie 等等,这很棒。但我不知道如何在它弹出之前将其延迟 5 秒。
有人可以帮忙吗?
jQuery('.close').click(function(){
jQuery('#popup-container').fadeOut();
jQuery('#active-popup').fadeOut();
});
var visits = jQuery.cookie('visits') || 0;
visits++;
jQuery.cookie('visits', visits, { expires: 1, path: '/' });
console.debug(jQuery.cookie('visits'));
if ( jQuery.cookie('visits') > 1 ) {
jQuery('#active-popup').hide();
jQuery('#popup-container').hide();
} else {
var pageHeight = jQuery(document).height();
jQuery('#popup-container').show(0).delay(5000);
}
如果有人可以帮助我编写代码,那就太好了。
【问题讨论】:
标签: jquery cookies popup delay