问题描述
我正在使用jQuery的小巧插件.每当我尝试同时使用手动触发器和delayIn来给Tipy打电话时,delayIn似乎不起作用:
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?
推荐答案
简短的答案是,一旦打开trigger:'manual'
,tipsy便不再需要delayIn了.最好的选择可能是让手动触发器(无论您在何处执行...tipsy('show')
)都执行延迟操作:
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);
}
}
这篇关于jQuery Tipsy:手动触发器和delayIn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!