Yes, use setTimeout and clear it every time you move the mouse. If the mouse has not been moved within the time specified in setTimeout, you can assume that the mouse has stopped moving. Using jQuery, you can do something like this:
var stop_timeout = false;
$(function() {
$().mousemove(function() {
clearTimeout(stop_timeout);
stop_timeout = setTimeout(function() {
alert("The mouse has stopped.");
}, 1000);
});
});
It's a bit hard to set and disable timeouts every time the mouse moves, but it should work for your purposes.
source
share