【发布时间】:2018-09-13 09:29:44
【问题描述】:
我的网站中有一个弹出窗口,当您第一次进入时会出现。我希望允许在需要时禁用或启用该选项。它是“包含”中的 .yml 文件,我正在使用 Magnific Pop-Up。
这是 JS 代码:
$(document).ready(function() {
$(window).on('load', function() {
var now, lastDatePopupShowed;
now = new Date();
if (localStorage.getItem('lastDatePopupShowed') !== null) {
lastDatePopupShowed = new Date(parseInt(localStorage.getItem('lastDatePopupShowed')));
}
if (((now - lastDatePopupShowed) >= (15 * 86400000)) || !lastDatePopupShowed) {
$.magnificPopup.open({
items: {
src: '#launch-popup'
},
type: 'inline'
}, 0);
localStorage.setItem('lastDatePopupShowed', now);
}
});
});
我很想听听你关于如何解决它的想法。
【问题讨论】:
-
你的意思是用配置标志禁止它加载?
标签: javascript popup jekyll magnific-popup