twitter-bootstrap – Twitter Bootstrap工具提示:是否有可能避免编写javascript?

前端之家收集整理的这篇文章主要介绍了twitter-bootstrap – Twitter Bootstrap工具提示:是否有可能避免编写javascript?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我注意到在使用Bootstrap的 Tooltip时,我仍然需要在javascript文件中手动包含此行以使其工作:
$('[rel="tooltip"]').tooltip();​

但是,引用documentation

You can use all Bootstrap plugins purely through the markup API
without writing a single line of JavaScript. This is Bootstrap’s first
class API and should be your first consideration when using a plugin.

但这不是我所看到的:http://jsfiddle.net/ccmyx/1/(尝试删除Javascript部分).

我错过了什么吗?

解决方法

不,与所有其他JavaScript组件相反,Tooltip和Popover都不支持data-api.这在 documentation中提到:

For performance reasons,the Tooltip and Popover data-apis are opt in. If you would like to use them just specify a selector option.

原文链接:https://www.f2er.com/bootstrap/233877.html

猜你在找的Bootstrap相关文章