引导模式显示,其中cookie设置为1天 [英] bootstrap modal show with cookie set for 1 day
本文介绍了引导模式显示,其中cookie设置为1天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Wordpress网站上有一个引导模式,我希望每24小时只出现一次.
I have a bootstrap modal on a Wordpress site that I would like to appear only once every 24 hours.
我以为我有它,但这是行不通的.
I thought I had it, but this isn't working.
$(document).ready(function() {
if ($.cookie('show') == null) {
$('#myModal').modal('show');
$.cookie('show', { expires: 1 });
}
});
这只会显示一次,然后再也不会显示.我要去哪里错了?
This only shows once and then never again. Where am I going wrong?
推荐答案
这对我有用:
$(document).ready(function() {
if ($.cookie('pop') == null) {
$('#myModal').modal('show');
$.cookie('pop', '1');
}
});
看来我原来是过期的:1错误.
It would seem that originally my expires: 1 was wrong.
这篇关于引导模式显示,其中cookie设置为1天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文