我知道如何在https://github.com/carhartl/插件设置的expiration参数中以秒为单位格式化这个(工作)位js?
以下是我所拥有的,运作良好(与ominflowWindow一起使用):
function OverlayClose() {
jQuery(".ow-overlay, .modal").hide("slow");
}
jQuery(document).ready(function () {
if (jQuery.cookie('product_2min_modal') == null) {
jQuery.cookie('product_2min_modal', 'yes', {
expires: 1,
path: '/'
});
setTimeout(function () {
jQuery('div.modal').omniWindow() // create modal
.trigger('show');
}, 5000 // and show it
);
}
});
我可以直接编写函数代码吗?
function OverlayClose() {
jQuery(".ow-overlay, .modal").hide("slow");
}
jQuery(document).ready(function () {
if (jQuery.cookie('product_2min_modal') == null) {
jQuery.cookie('product_2min_modal', 'yes', {
expires:
var date = new Date();
var minutes = 2;
date.setTime(date.getTime() + (minutes * 60 * 1000));
$.cookie("product_2min_modal", { expires: date });
,
path: '/'
});
setTimeout(function () {
jQuery('div.modal').omniWindow() // create modal
.trigger('show');
}, 5000 // and show it
);
}
});
答案 0 :(得分:2)
您有语法错误
function OverlayClose() {
jQuery(".ow-overlay, .modal").hide("slow");
}
jQuery(document).ready(function () {
if (jQuery.cookie('product_2min_modal') == null) {
var date = new Date();
var minutes = 2;
date.setTime(date.getTime() + (minutes * 60 * 1000));
jQuery.cookie('product_2min_modal', 'yes', {
expires: date,
path: '/'
});
}
});