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

前端 未结 22 940
感情败类
感情败类 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 16:47

    in angular 7 with bootstrap 4 and jquery I found this and it works fine. I used dispose because it destroys does not hide the tooltip.

      ngAfterViewChecked() {
        $('[data-toggle="tooltip"]').tooltip({
          trigger: 'hover'
        });
        $('[data-toggle="tooltip"]').on('mouseleave', function () {
          $(this).tooltip('dispose');
        });
        $('[data-toggle="tooltip"]').on('click', function () {
          $(this).tooltip('dispose');
        });
       }
    

提交回复
热议问题