gpt4 book ai didi

javascript - 如果光标在元素之外,如何让鼠标按下光标应用?

转载 作者:行者123 更新时间:2023-11-30 13:21:22 25 4
gpt4 key购买 nike

在这个 fiddle 中,您可以捕获黑框并将其拖到一个圆圈上

http://jsfiddle.net/S5AT6/

当用户捕获黑框,但他们的光标在 #marker 元素之外并在文档。

最佳答案

给你:Solution on jsFiddle

事情发生了变化:

CSS

// removed the !important flag here
cursor: url(https://mail.google.com/mail/images/2/openhand.cur), default;

// removed the div#marker here
.mouseDown {

JS

在准备好文档时添加:

$(document).on('mouseup', function(event) {
$('body').removeClass("mouseDown");
});

在您的 mousedown 函数中添加:

$('body').addClass("mouseDown");

关于javascript - 如果光标在元素之外,如何让鼠标按下光标应用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10159024/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com