jQuery: How to remove the tipsy tooltip?

前端 未结 9 1870
盖世英雄少女心
盖世英雄少女心 2021-01-08 01:17

I add the tipsy tooltip to divs with the .placeTaken class. The user can then drag boxes around, so I remove the class and add it to a new div instead. When this happens, I

9条回答
  •  醉酒成梦
    2021-01-08 02:06

    I recently had this issue, here's how I resolved it:

    Use this to set the original-title attribute to 'stop':

    $('.myElement').attr('original-title','stop');
    

    Then, in jquery.tipsy.js, change the code to the following:

    ...
    } else if (typeof opts.title == 'function') {
        title = opts.title.call(this);
    }
    
    if (title != 'stop') {    //line 32
        ...
        ...
    }                         //line 62
    ...
    

    In my release (0.1.7) the added code starts at line 32 and ends bracket at line 62. Tipsy should see that your title attribute equals 'stop' and wont try to open the tooltip.

    Also, this spits out some error to the console. It doesn't make any difference, but if you want to get rid of it, add this at line 73 (after adding previous code)

    try { tip.remove(); } catch(err){}
    

    POW

提交回复
热议问题