问题
How do I clear the timeout built-in to hoverIntent? I'd like to do it from within the over section of the same hoverIntent.
回答1:
Upon further research, I found that the timeout is stored as an attribute of the HTML element hoverIntent was applied to. So in order to clear the timeout do the following.
clearTimeout($(this).attr("hoverIntent_t"));
Keep in mind however, that each element will have it's own timeout attached to it. So to stop hoverIntent all together, you'll want to do the following:
$(this).siblings().each(function () {
clearTimeout($(this).parent().children().attr("hoverIntent_t"));
});
来源:https://stackoverflow.com/questions/5378523/hoverintent-cleartimeout