开发者

Determine if mouse is still in javascript/jQuery?

I'd like to be able to us开发者_JS百科e jQuery to trigger an event if the mouse has been stationary for a certain amount of time.

Any ideas? I'm not even sure where to start!


There's the idleTimer plugin which could be used for this purpose. And here's a nice demo of the plugin in action.


Hook up a mousemove() handler on the document and set a timeout. When timeout elapses, do your thing. Whenever the mouse moves again, cancel the timeout so it will fire relative to the last mouse movement.

This is a combination of jQuery and JavaScript.


jquery 1.4 offers a new method delay() for that

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜