jquery ui tooltip manual open /close

后端 未结 5 502
囚心锁ツ
囚心锁ツ 2020-12-24 07:48

is there a way to manually open close the jquery ui tooltip? I just want it to react to a click event toggling on/off. You can unbind all mouse events and it will rebind t

5条回答
  •  暖寄归人
    2020-12-24 08:19

    The tooltip have a disable option. Well i used it and here is the code:

    $('a').tooltip({
        disabled: true    
    }).click(function(){    
        if($(this).tooltip('option', 'disabled'))
            $(this).tooltip('option', {disabled: false}).tooltip('open');
        else
            $(this).tooltip('option', {disabled: true}).tooltip('close');
    }).hover(function(){
        $(this).tooltip('option', {disabled: true}).tooltip('close');
    }, function(){
        $(this).tooltip('option', {disabled: true}).tooltip('close');
    });
    

提交回复
热议问题