3

How can I use the hoverIntent jQuery Plugin with Bootstrap Tooltips (to show the tooltips only when the mouse is stopped on the button not on passing over)?

$(function() {
  $(".btn").hoverIntent(
    $('[data-toggle="tooltip"]').tooltip()
  );
})
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.hoverintent/1.9.0/jquery.hoverIntent.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<div class="container">
  <button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top">
  Tooltip on top
</button>


</div>
halfer
  • 19,824
  • 17
  • 99
  • 186
Behseini
  • 6,066
  • 23
  • 78
  • 125

1 Answers1

0

Modified based on a post by shalan.com, try this:

var config = {
    over : function(){ $(this).fadeIn('fast'); },   //appear gradually 
    out : function(){ $(this).fadeOut('fast'); },   //disappear gradually
    timeout : 100  };

   $("button[data_toggle='tooltip']").hoverIntent( config );
KenDev
  • 1
  • 2