JQuery和cookie弹出框
我有一个显示表单的弹出窗口。我只希望它在用户第一次进入网站时显示一次,然后不再显示。如果没有 cookie 并且弹出窗口有效,下面的代码将无法工作。
<script language="javascript" type="text/javascript">
window.onload=function(){
if(jQuery.cookie("popup") != "false"){
jQuery("#subscribePop").bPopup({
modal: true
});
jQuery.cookie("popup","false");
return false
}
}
</script>
我仍然无法使用此代码正常工作,没有错误或什么也没有。是否有另一种方法可以做到这一点更好,只希望 div 在输入时显示一次,然后在该用户关闭后不再显示
这是最好的方法吗?我愿意接受其他建议:)
I have a popup that shows a form. I only want it to show up once when the user first enters site, then after don't show again. The code below isn't working, without cookie and if the popup works.
<script language="javascript" type="text/javascript">
window.onload=function(){
if(jQuery.cookie("popup") != "false"){
jQuery("#subscribePop").bPopup({
modal: true
});
jQuery.cookie("popup","false");
return false
}
}
</script>
I still cant get this working with this code no errors or nothing. Is there even another way to do this thats better, just want div to show once when they enter then not to show again after its closed for that user
Is this the best way? I'm open to other suggestions :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
希望它能以某种方式有所帮助
Hope it helps one way or another