2

当用户将鼠标悬停在文章上时,我试图在博客文章上显示/隐藏覆盖。我有 hoverIntent 工作,因为它应该延迟鼠标悬停的事件,但我希望 mouseout 事件立即发生,就像没有 hoverIntent 一样。据我所知,没有办法为过度事件设置单独的超时值。有谁知道如何将它们分开,或者如何让 hoverIntent 只延迟结束事件?

$( 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"); }

谢谢你的帮助。

4

1 回答 1

3

超时是调用 out 函数之前的延迟 - 只需将其设置为 0。

或者,将 hoverIntent 称为:

$(".bg-entry").hoverIntent(showSummary, hideSummary);
于 2010-12-22T17:01:37.560 回答