我决定制作/测试 Cursors 跨浏览器,到目前为止,它在 Firefox 上运行完美,但在 Chrome 上 - 有点..
现在,自定义光标显示了,但是当您单击某处时,它不会改变,它会触发 mousedown 事件,但不会更改光标。我试过 mousedown();它改变了光标。我猜是 mouseup 事件导致了这个问题。
$("body").mousedown(function() {
$("body").addClass("clicked");
console.log("down");
});
$("body").mouseup(function() {
$("body").removeClass("clicked");
console.log("up");
});
CSS
body {
cursor: url("../img/cursor1.cur"), default;
}
.clicked {
cursor: url("../img/cursor2.cur"), default;
}
最佳答案
尝试点击并移动鼠标。
我认为 chrome 只会在鼠标移动时更改光标。
编辑:这是一个已知错误,请参阅 Getting the browser cursor from "wait" to "auto" without the user moving the mouse
关于javascript - jQuery + CSS cursor mousedown + Chrome = 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7638961/