[英]Popovers don't work with bootstrap?
Following the documentation I copied: 按照我复制的文档 :
<div class="container">
<div class="row">
<div class="bs-docs-example" style="padding-bottom: 24px;">
<a href="#" class="btn btn-large btn-danger" rel="popover" data-content="And here's some amazing content. It's very engaging. right?"
data-original-title="A Title">Click to toggle popover</a>
</div>
</div>
</div>
However it isn't working. 但它不起作用。 What am I doing wrong? 我究竟做错了什么?
I got it to work by doing two things: 我通过做两件事来完成它:
As Popover relies on Tooltip, make sure bootstrap-tooltip.js is included before bootstrap-popover.js. 由于Popover依赖于Tooltip,请确保在bootstrap-popover.js之前包含bootstrap-tooltip.js。
Activate the plugins with a line like $('.container a').popover();
用$('.container a').popover();
这样的行激活插件$('.container a').popover();
To have the popup at the top add data-placement="top"
to the a
tag. 要让弹出窗口位于顶部,请将data-placement="top"
到a
标记中。
Popovers are not initialized by default. 弹出窗口默认情况下未初始化。 If you included an all-inclusive bootstrap.js (v 2.2, 2.3), initialize it by: 如果您包含全包bootstrap.js(v 2.2,2.3),请将其初始化为:
$('a[data-toggle=popover]').popover();
<a href="#" id="LinkId">Text</a>
In document ready, 在文件准备好了,
$("#LinkId").popover({ title: '', content: "Popover Content", placement: 'left|top|etc', trigger: 'hover' });
All you need include is bootstrap.js
. 您只需要包含bootstrap.js
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.