简体   繁体   中英

Issue on Using jQuery hoverIntent Plugin With Bootstrap Tooltips

Can you please tale a look at this demo and let me know how I can use the hoverIntent jQuery Plugin with Bootstrap Tooltips (to show the tooltips only when the mouse is stoped 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> 

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 );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM