I would like to simulate a mouse move event. The setup is as follows
I have this element
<div class="target"></div>
Which in this test setup follows the mouse: DEMO
I have already a working simulation of the mousedown event (click the button). The code that generated this event looks like this:
function triggerMouseEvent (node, eventType) {
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent (eventType, true, true);
node.dispatchEvent (clickEvent);
}
But how do I create a fake movemove
event? Because I also need to provide a pageX and pageY for it. How do I provide this information when I create an event as shown above?