jQuery Set Mouse Position (not cursor position)

Michael picture Michael · Jul 30, 2009 · Viewed 55.6k times · Source

I have a link that, when clicked, I would like it to move the position of the mouse to the right (or anywhere within the viewport, for that matter).

in code it would probably look similar to the following:

$('a#expand').click(function(e){
    $(document)
       .mouseXPos(e.pageX + 50)
       .mouseYPos(e.pageY + 50);
});

Chaining might not be necessary, of course, but a similar 'set mouse position' functionality is what I am after.

I've seen solutions to move the cursor position to a certain spot in the text, but I didn't glean much from them.

Answer

MyItchyChin picture MyItchyChin · Jul 30, 2009

There is no mechanism for moving the mouse via JavaScript.