twitter-bootstrap Bootstrap javascript 或 popover 不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13923297/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 15:56:01  来源:igfitidea点击:

Bootstrap javascript or popover not working

javascripttwitter-bootstrappopover

提问by user1911283

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.

我的 Bootstrap 有问题。似乎 JS 以某种方式无法正常工作,因为即使是最简单的弹出窗口示例也无法正常工作。(http://jsfiddle.net/weuWk/363/) 如果在我的源代码中使用,这段在 JSFiddle 上正常工作的小代码只是创建一个按钮(没有悬停功能)。

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:

Modal-Plugin 实际上正在工作,所以这应该意味着我以正确的方式包含了 js 文件。无论如何我都会复制它:

 <script src="js/bootstrap.min.js"></script>
 <script src="http://code.jquery.com/jquery-latest.js"></script>

回答by Applehat

jQuery needs to be included before bootstrap's javascript, as bootstrap is just jQuery "plugins".

jQuery 需要包含在引导程序的 javascript 之前,因为引导程序只是 jQuery“插件”。

You should Include in this order:

您应该在此顺序中包括:

  1. jQuery
  2. Bootstrap
  3. Your Javascript
  1. jQuery
  2. 引导程序
  3. 你的Javascript

EDIT: Try this right before the closing body tag

编辑:在结束正文标签之前尝试这个

<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.

此外,控制台是您的朋友。检查并确保没有错误。

SOLVED:

解决了:

Solution: > Right order of Includes > fixing errors i got from my js console.

解决方案:> 包含的正确顺序> 修复我从我的 js 控制台得到的错误。