user1881006
user1881006

Reputation: 273

jQuery: Using mouseenter and mouseleave when page is in not in foreground

Is there a way to know when a mouse hovers/enters/leaves a div, even when the page is not in the foreground (i.e. not in focus.) I know it's possible, since Facebook has all sort of events that get called even when their page is in the background.

Upvotes: 0

Views: 90

Answers (1)

SeanCannon
SeanCannon

Reputation: 77956

Facebook's events that get called when it's blurred come from the server, not the client. They use long polling and server-side JavaScript. Blurred windows are still running JavaScript code, so the events will still fire. You can test this by having two Chrome windows open side by side - regardless which is "focused", the hover events will still work on both.

Upvotes: 1

Related Questions