使用hoverIntent延迟鼠标悬停但不延迟鼠标移出

发布于 2024-10-08 12:51:57 字数 552 浏览 0 评论 0原文

当用户将鼠标悬停在博客文章上时,我尝试显示/隐藏博客文章上的叠加层。我有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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜还是长夜 2024-10-15 12:51:57

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

或者,按以下方式调用hoverIntent:

$(".bg-entry").hoverIntent(showSummary, hideSummary);

The timeout is the delay before the out function is called - simply set it to 0.

Alternatively, call hoverIntent as:

$(".bg-entry").hoverIntent(showSummary, hideSummary);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文