如何延迟()qtip()加载工具提示
我这样加载:
$('.selector').each(function(){
$(this).qtip({
content: { url: '/qtip.php?'+$(this).attr('rel')+' #'+$(this).attr('div'), text:'<center><img src="/images/loader.gif" alt="loading..." /></center>' },
show: { delay: 700, solo: true,effect: { length: 500 }},
hide: { fixed: true, delay: 200 },
position: {
corner: {
target: 'topRight',
tooltip: 'left'
}
},
show: {
// Show it on click
solo: true // And hide all other tooltips
},
style: {
name: 'light',
width: 730,border: {
width: 4,
radius: 3,
color: '#5588CC'
}
}
});
});
看起来好像是有一个延迟原因造成的。但 qtip.php 的加载没有延迟,这正是我真正想要的(以减少不需要的请求)
我可以在加载 qtip.php 之前延迟 300 毫秒吗?
I Load this way:
$('.selector').each(function(){
$(this).qtip({
content: { url: '/qtip.php?'+$(this).attr('rel')+' #'+$(this).attr('div'), text:'<center><img src="/images/loader.gif" alt="loading..." /></center>' },
show: { delay: 700, solo: true,effect: { length: 500 }},
hide: { fixed: true, delay: 200 },
position: {
corner: {
target: 'topRight',
tooltip: 'left'
}
},
show: {
// Show it on click
solo: true // And hide all other tooltips
},
style: {
name: 'light',
width: 730,border: {
width: 4,
radius: 3,
color: '#5588CC'
}
}
});
});
And that looks like if there is a thelay cause of the effect. but qtip.php it's loaded with no delay which is what I really want (to reduce unneeded requests)
Can I delay 300ms before loading qtip.php?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以将其设置为使用自定义事件,然后在超时后触发该事件。如果您想等到鼠标停止,hoverIntent 插件可能会有所帮助。
使用hoverIntent:
如果你想让hoverIntent在触发前等待更长时间,你可以给它一个带有
interval
属性的配置对象:没有插件(我没有测试过这个):
You could set it to use a custom event, then trigger the event after a timeout. The hoverIntent plugin might help, if you want to wait until the mouse stops.
Using hoverIntent:
If you want to make hoverIntent wait longer before triggering, you can give it a configuration object with an
interval
property:Without a plugin (I haven't tested this):
这里我只是创建了另一个参数,使用起来更简单,我在qtip1中测试了这个(不确定qtip2)
要添加这个参数,你需要修改qtip中函数assignEvents()的代码:
Here I just created another param and it's more simple to use, I have tested this in qtip1(not sure about qtip2)
To add this param, you need to modify the code of function assignEvents() in qtip:
对于
qtip2
,在初始化插件时有一个名为show
的参数,它表示当show.event<时延迟显示工具提示的时间(以毫秒为单位) /code> 在
show.target
上触发。例如:
For
qtip2
there is parameter, calledshow
while initializing the plugin, which represents time in milliseconds by which to delay the showing of the tooltip when theshow.event
is triggered on theshow.target
.For example: