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

前端 未结 22 908
感情败类
感情败类 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:04

    David's answer above helped to fix my problem. I had both hover and click event on the button. Firefox on MAC did behave as I wanted. That is, show tooltip when hover, do not show tooltip for click. On other browsers and OS, When I click, the tooltip appear and stay as show. Even if i move the mouse to other buttons for hover. This is what I had:

    $('[data-toggle="tooltip"]').tooltip({placement: 'right', html: true}); 
    

    This is the fix:

    $('[data-toggle="tooltip"]').tooltip({placement: 'right', html: true, trigger: 'hover'}); 
    

提交回复
热议问题