jQuery设置鼠标位置(不是光标位置) [英] jQuery Set Mouse Position (not cursor position)

查看:295
本文介绍了jQuery设置鼠标位置(不是光标位置)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个链接,当单击该链接时,我希望它可以将鼠标的位置向右移动(或就此而言,在视口中的任何位置).

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.

推荐答案

没有通过JavaScript移动鼠标的机制.

There is no mechanism for moving the mouse via JavaScript.

这篇关于jQuery设置鼠标位置(不是光标位置)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆