javascript - 如何在第二次访问 wordpress 页面时隐藏 Bootstrap 模式

标签 javascript wordpress twitter-bootstrap

我正在使用 Bootstrap 主题在 wordpress 中开发一个页面。页面加载时有一个模式窗口,上面有注册表单。用户不填写表格就看不到内容。我的问题是,每当用户返回该页面时,它都会显示模式窗口,我想将其限制为一次为用户。我怎样才能实现。

这是我的模态 Js:

<script type="text/javascript">
jQuery(document).ready(function($) {
    $('#DownloadSignup').modal('show');
});
</script>

这是我尝试过但不起作用的方法:

<script>
jQuery(document).ready(function($) {
    var isshow = localStorage.getItem('status');
  // alert(isshow);
    if (isshow == null) {
        localStorage.setItem('isshow', 1);

        // Show popup here
        $('#DownloadSignup').modal('show');
    } else if(isshow != null) {
       $('#DownloadSignup').modal('hide');
    }
});
</script>

最佳答案

改变这个

localStorage.setItem('isshow', 1);

localStorage.setItem('status', 'shown');

关于javascript - 如何在第二次访问 wordpress 页面时隐藏 Bootstrap 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33950878/

相关文章:

javascript - 我无法设置响应式菜单

javascript - 当我尝试在另一个 Ajax 函数中调用 Ajax 函数时,返回值 = 未定义

javascript - 在nodejs中读取csv并为每一行创建新文件

html - 如何让图像小部件居中显示在我的 WordPress 网站的页脚中?

jquery - 禁用单击每行中的最后一列

javascript - 有没有办法将单词颜色 ("red"、 "blue"、 "green") 转换为 #123456 值?

javascript - 如何利用浏览器宽度和body宽度动态计算固定div元素的定位宽度

wordpress - 错误 : In file './docker-compose.yml' , 卷必须是映射而不是字符串

javascript - angularjs 在 ng-repeat 中展开所有 Accordion

javascript - Bootstrap 日期时间选择器定位