javascript - 推特 Bootstrap : Uncaught TypeError: Object modal1 has no method 'toggle'

标签 javascript jquery html css twitter-bootstrap

我最近做了一些更改,将一些图标作为按钮,使 twitter-bootstrap 模态出现在我的网站上,但我现在收到错误:

Uncaught TypeError: Object modal1 has no method 'toggle'

在某些情况下,模态框似乎被切断了,或者根本没有出现(有许多是动态创建的)。相关代码如下:

按钮 HTML:

 <a data-toggle="modal" href="#myModal-{{$artist->id}}" class="Details">
                                  <span class="fa-stack">
                                  <i class="fa fa-circle-o fa-stack-2x"></i>
                                  <i class="fa fa-plus fa-stack-1x"></i>
                                  </span> 
    </a>

模态 HTML:

  <div id="myModal-{{$artist->id}}" class="modal hide fade side-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
    <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times fa-lg"></i></button>
    </div>

        <div class="modal-body">
          <article class="musicainDEtailImgBox"> <a href="#"><img src="{{$artist->image_path}}" alt="" title="" width="240" height="240"></a>
            <h5>{{$artist->stage_name}}</h5>
    </div>
    </div>
    </div>

知道为什么会这样吗?我正在为图标使用很棒的字体图标。

编辑:

javascript 控制台错误引用了 bootstrap.js 的第 1008 行:

if (!data) $this.data('modal', (data = new Modal(this, options)))
      if (typeof option == 'string') data[option]()

最佳答案

似乎是:

  1. 包含 Font Awesome 脚本干扰了 Bootstrap 脚本的正确加载
  2. Font Awesome 图标阻止了“a”上的点击事件。

你能在http://www.bootply.com/上提供源代码吗? ?

关于javascript - 推特 Bootstrap : Uncaught TypeError: Object modal1 has no method 'toggle' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22166331/

相关文章:

javascript - 我是疯了还是 jsFiddle 有问题?

javascript - AJAX - 为什么页面重定向在这里失败?

javascript - 在 JavaScript 数组中求和

javascript - 使用 $(this).closest ("tr").find ("td:eq(0)").text() 将值传递给 javascript,但 ID 不包含在表中

javascript - JQuery UI 拖放(获取 Draggable 值以显示和隐藏文本区域框)

javascript - js如何让一个变量值根据用户登录 Node 存在

javascript - 获取在模态框内动态创建的 &lt;input type ="text"> 的值

javascript - 如何调试谁覆盖了我的 jQuery ajax 行为?

html - CSS 为什么最后一个 li 没有被 li :nth-child(odd) or li:nth-child(even)? 定位

HTML CSS 表格行重叠