当用户将鼠标悬停在博客文章上时,我尝试显示/隐藏博客文章上的叠加层。我有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"); }
感谢您的帮助。
最佳答案
超时是调用 out 函数之前的延迟 - 只需将其设置为 0。
或者,将hoverIntent 调用为:
$(".bg-entry").hoverIntent(showSummary, hideSummary);
关于jquery - 使用hoverIntent延迟鼠标悬停但不延迟鼠标移出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4511542/