开发者

Using hoverIntent to delay mouseover but not mouseout

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 ho开发者_如何学运维verIntent. 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.


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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜