-2

How can I make the cursor jump off an item when the item is clicked?

I have an image that acts different ways when hovered, clicked, double clicked etc, and I'd like the double click to throw the cursor to the other side of the screen or at least off the image or the div the image is in.

As in the image clicked would start repelling the cursor after click?

nancyeh
  • 1
  • 1

1 Answers1

-1

There is no mechanism for moving the mouse by javascript. However you can put a control like input and on the click on the image you put the focus on that control. So this way the mouse cursor moves to another part of the page.

The below jQuery code will help you.

So the click event of the img:

$("#img_id").click(function(){
    $("#somecontrol_id").focus()
});

More information you can look at this link.

Joe Clinton
  • 145
  • 1
  • 12
  • OP wants to move the cursor itself, not focus on another element. – gsquaredxc Aug 26 '18 at 16:56
  • No......The cursor stays on the clicked image and nothing happens. The image has onclick and ondblclick functions, can they be interfering? – nancyeh Aug 26 '18 at 17:50