按钮点击后,Bootstrap的工具提示不会消失鼠标离开 [英] Bootstrap's tooltip doesn't disappear after button click & mouseleave

查看:196
本文介绍了按钮点击后,Bootstrap的工具提示不会消失鼠标离开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在bootstrap的工具提示中遇到问题:当我点击一个按钮时,即使光标位于按钮之外,工具提示也会保持不变。我查看了手册 - Bootstrap的工具提示,如果我点击按钮,我看到同样的问题。有没有解决方法可以解决这个问题?刚尝试了最新的FF,IE。

I have a problem with bootstrap's tooltip : When I click on a button, tooltip stays even if is the cursor is outside of the button. I have looked into the manual - Bootstrap's tooltip and if I'm clicking on the buttons, I see the same problem. Is there any solution to fix this? Just tried in latest FF, IE.

推荐答案

这是因为触发器没有设定。触发器的默认值是'悬停焦点',因此在单击按钮后工具提示保持可见,直到单击另一个按钮,因为按钮是聚焦

This is because trigger is not set. The default value for trigger is 'hover focus', thus the tooltip stay visible after a button is clicked, until another button is clicked, because the button is focused.

所以你所要做的就是将触发器定义为'hover'。在单击按钮后链接到的相同示例下方没有保留工具提示:

So all you have to do is to define trigger as 'hover' only. Below the same example you have linked to without persisting tooltips after a button is clicked :

$('[data-toggle="tooltip"]').tooltip({
    trigger : 'hover'
})  

小提琴中的doc示例 - > http://jsfiddle.net/vdzvvg6o/

the doc example in a fiddle -> http://jsfiddle.net/vdzvvg6o/

这篇关于按钮点击后,Bootstrap的工具提示不会消失鼠标离开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆