Jquery UI tooltip. Set timeout and set hover event

2019-01-17 23:10发布

I've googled about 2 days and can't figure out how to set timeout for http://api.jqueryui.com/tooltip/ ???

Maybe i should use jquery hoverIntent ?

here is my code

$('*[class*="help_"]').tooltip({
    open: function(e,o){
        $(o.tooltip).mouseover(function(e){
            $('*[class*="help_"]').tooltip('open');
        });
        $(o.tooltip).mouseout(function(e){
        });         
    },
    close: function(e,o) {}
});

7条回答
老娘就宠你
2楼-- · 2019-01-17 23:45

I also looked for a similar solution, showing the tooltip normally, but when mouseover on the tooltip it should stay (the content of a tooltip is some buttons).

I don't want a whole framework(qtip) to do just that, i'm already using jqUI all over my site.

so i did this:

$( document ).tooltip({
  show: null, // show immediately 
  items: '.btn-box-share',
  hide: {
    effect: "", // fadeOut
  },
  open: function( event, ui ) {
    ui.tooltip.animate({ top: ui.tooltip.position().top + 10 }, "fast" );
  },
  close: function( event, ui ) {
    ui.tooltip.hover(
        function () {
            $(this).stop(true).fadeTo(400, 1); 
            //.fadeIn("slow"); // doesn't work because of stop()
        },
        function () {
            $(this).fadeOut("400", function(){ $(this).remove(); })
        }
    );
  }
});
查看更多
登录 后发表回答