javascript - Bootstrap 弹出窗口无法在我自己的网站上运行

标签 javascript twitter-bootstrap popover

所以我想要的是使用弹出窗口作为信息弹出窗口,这是我使用的代码:

<li>Commercial Use <a href="#" data-toggle="popover" title="" data-content="And here's some amazing content. It's very engaging. right?" role="button" data-original-title="A Title"><i class="fa fa-question-circle"></i></a></li>

它只是将我链接到#

这在我的页脚中:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="/js/bootstrap.js"></script>

之前它就在我的脑海中,但我将其移回页脚,因为我认为这可能是问题所在。

我已经尝试过 http://getbootstrap.com/javascript/#popovers 中的标准代码但这也行不通!如果您转到http://getbootstrap.com/javascript/#popovers你看到它说需要包含工具提示插件,但是当转到 http://getbootstrap.com/javascript/#js-individual-compiled 时根据 Bootstrap 你会看到:

Both bootstrap.js and bootstrap.min.js contain all plugins in a single file. Include only one.

我现在几乎迷失了。

希望有人能帮助我。

提前致谢,

MrBlackDrag0nfly

最佳答案

我不太确定问题出在哪里,请确保:

(1) 您已包含 bootstrap css

(2) 尝试插入数据容器属性。和“id”:

<li>Commercial Use <a href="#" id="myPopovers" data-toggle="popover" title="" data-content="And here's some amazing content. It's very engaging. right?" role="button" data-original-title="A Title" data-container="body"><i class="fa fa-question-circle"></i></a></li>

(3) 从 Bootstrap 来看,它说:

**Opt-in functionality**
For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning you must       initialize them yourself.

这意味着您应该通过 JavaScript 对其进行初始化:

$(document).ready(function(){
  $("#myPopovers").popover(); // or $("#myPopovers").popover('show');
});

关于javascript - Bootstrap 弹出窗口无法在我自己的网站上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22880436/

相关文章:

javascript - Bootstrap : move div from one column to another, 移动设备订单计数

javascript - AngularJS UI-Bootstrap Typeahead 没有匹配项

ios - 弹出窗口中的 CNContactPickerViewController (iOS)

ios - 按下时以编程方式移除 UIBarButtonItem 上的灯光?

javascript - Node : How to make spawn function synchronous instead of using spawnSync?

javascript - 数组重新循环以删除先前生成的一组数组数据

javascript - 如何在嵌套表中选择不包含某些元素的标签?

css - 推特 Bootstrap : align element to bottom

ios - 简单的快速颜色选择器弹出窗口(iOS)

javascript - 包装字符串中出现的所有单词