[英]Bootstrap JS works, but not tooltip
I've confirmed that my bootstrap.js works by invoking a dropdown, and also a modal popup. 我已经确认我的bootstrap.js可以通过调用下拉菜单以及模式弹出窗口来工作。 Both of them work, but when I try to get tooltip to work it fails. 它们都可以使用,但是当我尝试使用工具提示时,它会失败。 As far as I understand from the documentation here you merely have to put this: 据我从此处的文档了解,您只需要输入以下内容:
<a href="#" data-toggle="tooltip" title="" data-original-title="Default tooltip">you probably</a>
However, no tooltip appears at all. 但是,根本没有工具提示出现。 Yet, the dropdown that I invoke with the same API as below works: 但是,我使用与以下相同的API调用的下拉菜单有效:
<div class="dropdown">
<a class="dropdown-toggle" id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="/page.html">
Dropdown
<b class="caret"></b>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
...
</ul>
</div>
You're using the tooltips incorrectly. 您使用的工具提示不正确。 You only need to provide the title
attribute - the tooltip plugin sets the data-original-title
itself. 您只需要提供title
属性-工具提示插件即可设置data-original-title
本身。
Also, from the documentation: 另外,从文档中:
For performance reasons, the tooltip and popover data-apis are opt in, meaning you must initialize them yourself. 出于性能原因,选择使用工具提示和popover数据API,这意味着您必须自己对其进行初始化。
So, do something like: 因此,请执行以下操作:
$('[data-toggle="tooltip"]').tooltip()
as a catch-all. 作为一个包罗万象的东西。 You most likely want to select fewer elements to keep decent performance, though. 不过,您很可能希望选择较少的元素来保持良好的性能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.