Bootstrap's tooltip doesn't disappear after button click & mouseleave

前端 未结 22 835
感情败类
感情败类 2020-12-07 16:24

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 - Bootstra

22条回答
  •  醉梦人生
    2020-12-07 17:01

    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.

    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'
    })  
    

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

提交回复
热议问题