微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.jb51.cc/bootstrap/233877.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐