Bootstrap 工具提示不起作用 [英] Bootstrap tooltips not working
问题描述
我要疯了.
我有以下 HTML:
<a href="#" rel="tooltip" title="A nice tooltip">test</a>
Bootstrap 风格的工具提示拒绝显示,只是一个普通的工具提示.
And the Bootstrap style tooltip refuses to display, just a normal tooltip.
我已经让 bootstrap.css 工作得很好,我可以看到里面的类
I've got bootstrap.css working just fine, and I can see the classes in there
我的 HTML 文件末尾有所有相关的 JS 文件:
I've got all of the relevant JS files at the end of my HTML file:
<script src="bootstrap/js/jquery.js"></script>
<script src="bootstrap/js/bootstrap-alert.js"></script>
<script src="bootstrap/js/bootstrap-modal.js"></script>
<script src="bootstrap/js/bootstrap-transition.js"></script>
<script src="bootstrap/js/bootstrap-tooltip.js"></script>
我查看了 Bootstrap 示例的源代码,但在其中的任何地方都看不到任何启动工具提示的内容.所以我猜它应该可以正常工作,还是我在这里遗漏了一些重要的东西?
I've looked at the source of Bootstrap's example and cannot see anything that initiates the tooltip anywhere in there. So I'm guessing it should just work, or am I missing something vital here?
我有模态和警报以及其他工作正常的东西,所以我不是一个彻头彻尾的白痴;)
I've got modals and alerts and other things working just fine, so I'm not a total moron ;)
感谢您的帮助!
推荐答案
总结:使用 jQuery 选择器激活你的工具提示
To sum up: activate your tooltips using jQuery selectors
<script type="text/javascript">
$(function () {
$("[rel='tooltip']").tooltip();
});
</script>
实际上,您不需要使用属性选择器,您可以在任何元素上调用它,即使它的标签中没有 rel="tooltip"
.
In fact, you don't need to use the attribute selector, you can invoke it on any element even if it doesn't have rel="tooltip"
in its tag.
这篇关于Bootstrap 工具提示不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!