我最近做了一些更改,将一些图标作为按钮,使 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]()
最佳答案
似乎是:
- 包含 Font Awesome 脚本干扰了 Bootstrap 脚本的正确加载 或
- Font Awesome 图标阻止了“a”上的点击事件。
你能在http://www.bootply.com/上提供源代码吗? ?
关于javascript - 推特 Bootstrap : Uncaught TypeError: Object modal1 has no method 'toggle' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22166331/