jQuery tipsy: manual triggers and delayIn

删除回忆录丶 提交于 2020-01-02 11:03:25

问题


I'm using the tipsy plugin for jQuery. Whenever I try to call tipsy with both a manual trigger and delayIn, the delayIn doesn't seem to work:

$('.interest').tipsy({trigger:'manual', gravity: 'n', html: true, delayIn: 3000});

Any ideas as to why?


回答1:


The short answer is that once you turn on trigger:'manual', tipsy doesn't take care of delayIn any more. Your best bet might be to just have your manual trigger (wherever you do ...tipsy('show')) do a delay instead:

setTimeout("\$('#link').tipsy('show');",3000);

You could also look at the tipsy source to see that they have a slightly more elegant version that you could work from:

    function enter() {
        var tipsy = get(this);
        tipsy.hoverState = 'in';
        if (options.delayIn == 0) {
            tipsy.show();
        } else {
            setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
        }
    }


来源:https://stackoverflow.com/questions/3758657/jquery-tipsy-manual-triggers-and-delayin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!