I was wondering if there was a way to detect if the mouse is idle for like 3 seconds in jQuery. Is there a plugin that I am unaware of? Because I don't believe there to be a native jQuery method. Any help would be much appreciated!
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
You can listen to the
mousemove
event, start a timeout whenever it occurs and cancel any existing timeout.DEMO
This can be very easily done without jQuery as well (only binding the event handler here is jQuery-specific).
No need for a plugin, or even for jQuery at all: