我们正在利用 tooltipster 插件在信息图标上显示工具提示。这在悬停时效果很好。但我们还需要让它显示是否有人也点击了信息图标。
我似乎找不到任何有关如何在悬停和焦点上启用弹出窗口的示例。
这是该项目中已经存在的内容:
HTML:
<a href="#"><span class="tooltip">Some handy tooltip text...</span></a>
Javascript:
if ($('.tooltip').length) {
$('.tooltip').tooltipster({
theme: '.tooltipster-shadow',
maxWidth: 220,
interactive: true,
functionReady: function () {
$('html').click(function () {
$.fn.tooltipster('hide');
});
}
});
}
最佳答案
您可以像这样使用 Tooltipster 的 show 方法:
$('.tooltip').tooltipster().focus(function() {
$(this).tooltipster('show');
});
<强> Demo
关于javascript - 通过焦点和悬停显示工具提示提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28684592/