Jquery UI tooltip. Set timeout and set hover events. Freeze tooltip on mouseover

前端 未结 7 1345
遥遥无期
遥遥无期 2020-12-09 11:51

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

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-09 12:40

    This version ensures the tooltip stays visible long enough for user to move mouse over tooltip and stays visible until mouseout. Handy for allowing the user to select some text from tooltip. Part of the code comes from Antonimo.

    $(document).on("click", ".tooltip", function() {
        $(this).tooltip(
            { 
                items: ".tooltip", 
                content: function(){
                    return $(this).data('description');
                }, 
                close: function( event, ui ) {
                    var me = this;
                    ui.tooltip.hover(
                        function () {
                            $(this).stop(true).fadeTo(400, 1); 
                        },
                        function () {
                            $(this).fadeOut("400", function(){
                                $(this).remove();
                            });
                        }
                    );
                    ui.tooltip.on("remove", function(){
                        $(me).tooltip("destroy");
                    });
              },
            }
        );
        $(this).tooltip("open");
    });
    

    HTML

    Test
    

    Sample: http://jsfiddle.net/A44EB/123/

提交回复
热议问题