【问题标题】:Bootstrap modal stopped working randomlyBootstrap 模态随机停止工作
【发布时间】:2014-09-12 19:24:24
【问题描述】:

我的页面上有两个模态弹出窗口,前几天它们运行良好。现在他们已经停止工作,我不知道为什么。

这是链接 HTML:

<a href="#requestSample" data-toggle="modal" data-target="#requestSample">Request Samples</a>

这是模态:

<div class="modal" id="requestSample" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
  <div class="modal-content">
    <div class="modal-body">
      <?php gravity_form(4, $display_title=false, $display_description=false, $display_inactive=false, $field_values=null, $ajax=false); ?>
    </div>
  </div>
</div>

这是我正在处理的页面:http://michaelscollins.com

【问题讨论】:

  • 这很奇怪。它在小提琴中运行良好:jsfiddle.net/isherwood/6z3b27nw
  • 您的移动菜单也会消失。这是新症状吗?
  • 不,它只是没有针对移动设备进行优化——在桌面设备上向其发送付费流量。
  • 是的,我知道代码是正确的...一定是插件之类的,虽然我刚刚禁用了一堆插件,但仍然无法正常工作...很难诊断
  • 通常会导致控制台错误。

标签: javascript wordpress twitter-bootstrap bootstrap-modal


【解决方案1】:

我遇到了同样的问题,但我能得到的唯一解决方案是按以下顺序添加链接:

  1. &lt;link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"&gt;

  2. &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"&gt;&lt;/script&gt;

  3. &lt;script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"&gt;&lt;/script&gt;

【讨论】:

    【解决方案2】:

    我注意到,如果我在显示的项目上调用 .modal('show') ,它就会停止工作。 即

    $('#modal').modal('show');
    $('#modal').modal('show');
    $('#modal').modal('hide');
    // Modal will not go away after this
    

    【讨论】:

      猜你喜欢
      • 2016-09-30
      • 2014-04-11
      • 2014-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-14
      相关资源
      最近更新 更多