使用hoverIntent延迟鼠标悬停但不延迟鼠标移出
当用户将鼠标悬停在博客文章上时,我尝试显示/隐藏博客文章上的叠加层。我有hoverIntent,它应该在鼠标悬停时延迟事件,但我希望mouseout事件立即发生,就像没有hoverIntent一样。据我所知,没有办法为结束和结束事件设置单独的超时值。有谁知道如何将它们分开,或者如何让hoverIntent仅延迟over事件?
$( document ).ready( function() {
$(".bg-overlay").hide();
$(".bg-entry").hoverIntent({
over: showSummary,
timeout: 650,
out: hideSummary
});
});
function showSummary(){ $(this).children(".bg-overlay").fadeIn("fast"); }
function hideSummary(){ $(this).children(".bg-overlay").fadeOut("fast"); }
感谢您的帮助。
I am attempting to show/hide an overlay on blog articles when the user hovers over the articles. I have hoverIntent working as it should to delay the event on mouseover, but I would like the mouseout event to happen instantly as it would without hoverIntent. As far as I can tell there is no way to set a separate timout value for the over and out events. Does anybody know how to separate them, or how to have hoverIntent only delay the over event?
$( document ).ready( function() {
$(".bg-overlay").hide();
$(".bg-entry").hoverIntent({
over: showSummary,
timeout: 650,
out: hideSummary
});
});
function showSummary(){ $(this).children(".bg-overlay").fadeIn("fast"); }
function hideSummary(){ $(this).children(".bg-overlay").fadeOut("fast"); }
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
超时是调用 out 函数之前的延迟 - 只需将其设置为 0。
或者,按以下方式调用hoverIntent:
The timeout is the delay before the out function is called - simply set it to 0.
Alternatively, call hoverIntent as: