Bootstrap javascript或popover无法正常工作 [英] Bootstrap javascript or popover not working
问题描述
我的Bootstrap出了问题。似乎JS不能以某种方式正常工作,因为即使是最简单的弹出窗口的例子也不起作用。 (http://jsfiddle.net/weuWk/363/)
这个在JSFiddle上正常工作的小代码只是创建一个Button(没有悬停功能),如果在我的源代码中使用的话。
Got a Problem with my Bootstrap. It seems as if the JS is not working correctly somehow, because even the easiest examples of popovers dont work. (http://jsfiddle.net/weuWk/363/) This little piece of code which works correctly on JSFiddle, is just creating a Button(w/o hover functionality) if used in my source code.
Modal-Plugin实际上正在工作,所以这应该意味着我以正确的方式包含js文件。无论如何我会复制它:
The Modal-Plugin is actually working, so this should mean that i include the js files in the right way. I will copy it anyway:
<script src="js/bootstrap.min.js"></script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
推荐答案
jQuery需要在bootstrap的javascript之前包含,作为bootstrap只是jQuery插件。
jQuery needs to be included before bootstrap's javascript, as bootstrap is just jQuery "plugins".
你应该包含在这个顺序中:
You should Include in this order:
- jQuery
- Bootstrap
- 您的Javascript
编辑:在关闭正文标记之前尝试此操作
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
$(function(){
$('#test').popover();
});
</script>
此外,控制台是你的朋友。检查并确保没有错误。
Also, the console is your friend. Check and make sure there are no errors.
已解决:
解决方案:>包含的正确顺序>修复我从js控制台得到的错误。
Solution: > Right order of Includes > fixing errors i got from my js console.
这篇关于Bootstrap javascript或popover无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!