我注意到在使用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.