I wrote a callback function to record mouse event:
var body = document.querySelector("body");
var callback = function (e) {
console.log(e.type);
}
body.addEventListener('mousedown', callback, false);
body.addEventListener('mouseup', callback, false);
body.addEventListener('mousemove', callback, false);
what confused me is, when I do a click, in addition to triggering the mousedown
and mouseup
events, it will trigger mousemove
event too.
Watch the demo here: http://jsfiddle.net/r6Gqn/1/
Why is it that I do not move the mouse, but trigger the mousemove
event? How can I stop triggering the mousemove
event?