引导模式不是一个函数 [英] bootstrap modal is not a function
问题描述
我正在使用 twitter bootstrap 模态对话框.它工作正常,只用
I'm using twitter bootstrap modal dialog. And it works fine while only opening it with
<a class="btn" data-controls-modal="my-modal" >Launch Modal</a>
但是当我尝试类似的事情时
But when I try something like
$('#close_popup').click(function(){
$('#rules').modal('toggle');
});
我收到一个 JavaScript 错误:
I get a javascript error:
bootstrap modal 不是函数
bootstrap modal is not a function
此外.据我了解 .close
链接必须关闭窗口,但它没有.我做错了什么?
Moreover. As far a I understand link with .close
must close the window and it doesn't.
What do I do wrong?
推荐答案
我不知道你有没有发现这个问题是几个月前你问这个问题的时候,但我遇到了同样的问题问题,是和其他插件冲突了,我把解决方法贴出来供以后查询.
I don't know if you have figured out this issue or not being it was a couple months ago when you asked the question, but I came across the same problem and it had to do with a conflict with another plugin, so I will post the solution for future inquiries.
以下是我为解决此问题所做的示例.
Here is an example of what I did to get around this issue.
function ShowImageInModal(path) {
jQuery.noConflict();
(function ($) {
$('#modalImage').removeAttr("src").attr("src", path);
$('#myModal').modal('show');
}
)(jQuery);
}
这篇关于引导模式不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!