Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hover does not always call 'over' when using a timeout for 'out' #28

Closed
dirv opened this issue Aug 7, 2014 · 2 comments
Closed

Hover does not always call 'over' when using a timeout for 'out' #28

dirv opened this issue Aug 7, 2014 · 2 comments
Milestone

Comments

@dirv
Copy link

dirv commented Aug 7, 2014

Hi,

I'm using hoverIntent for a menu system that incorporates a timeout for calling the 'out' handler. Closing and opening menus does not work as I'd expect. For two hover items A and B, if I move quickly from A to B to A again then I expect A to open, but it doesn't. There's a script to reproduce this issue on JSFiddle:
http://jsfiddle.net/d_ir/u31xjd5d/1/

From a quick look at the source, it would seem that the ob.hoverIntent_t does not get called for the mouseleave event on the first tab item.

I can workaround the issue by removing the "if (!ob.hoverIntent_s)" condition on line 101.

I'm not sure if this is something I'm doing wrong, or if this is a bug. Any help would be appreciated.

Thanks
Daniel

@usmonster
Copy link
Collaborator

This might be the same issue as #35. We'll see if the fix for that also fixes this.

@usmonster
Copy link
Collaborator

Upon further investigation, it looks like the plugin is actually working as designed.

In your example, the over function is first called for item A, but the out function is actually never called because the mouse pointer re-enters the item before the (half-second, in your case) timeout is up. The fact that "A" was closed is just a result of the over function that was called for item B, since it closes all open items before opening the target item.

At this point, however, item A is still considered "active" by the plugin, so its over handler will not be called again until it has a chance to deactivate via out--that is, the mouse pointer needs to leave item A for at least 500 ms.

I suspect that the specific behavior you're trying to achieve is discussed in #6 (and may be made even easier by #11 once it lands). (Contrary to what I'd said in the previous comment, this issue has nothing to do with #35.)

I'll close the issue now since it's not a bug in the plugin, but feel free to follow my advice from #6 or leave a comment if you have any more questions. Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants