How do I trigger a mouse move event with custom coordinates in jQuery?
I tried the following:
canvas1.trigger('mousemove',{pageX: window.width/2 , pageY: window.height/2});
and I also tried running this:
canvas1.trigger('mousemove',{pageX: 800 , pageY: 800});
However the pageX and pageY seems to be undefined in the event.
I've called this inside a mouse move event:
console.log("Fake mouse move event called successfully! X:", e.pageX, "& Y:", e.pageY);
And I didn't move my mouse at all so I could only see the fake event.
This is the result I am getting:
Fake mouse move event called successfully! X: undefined & Y: undefined
I also tried this with clientX
and clientY
, and the problem persists..
Has anyone got an idea to how to fix this problem? Have no idea what is going on here.
Thanks, help much appreciated!
EDIT:
canvas1 = $("#canvas");