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

前端 未结 22 933
感情败类
感情败类 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条回答
  •  萌比男神i
    2020-12-07 16:44

    This solution worked for me.

    $('a[data-toggle="tooltip"]').tooltip({
      animated: 'fade',
      placement: 'bottom',
      trigger: 'click'
    });
    
    $('a[data-toggle="tooltip"]').click(function(event){
      event.stopPropagation();
    });
    
    $('body').click(function(){
      $('a[data-toggle="tooltip"]').tooltip('hide');
    });
    

    fiddle

    I tried most of the solutions given in previous answers, but none of them worked for me.

提交回复
热议问题