Javascript 光标:无;不';不要总是在铬上工作
使用Javascript 光标:无;不';不要总是在铬上工作,javascript,css,google-chrome,cursor,mouse,Javascript,Css,Google Chrome,Cursor,Mouse,使用光标:无Dynamicly(使用javascript)在Chrome上的工作不一致。这在opera或firefox上运行良好。css实际上会改变,但光标不会隐藏!YouTube也使用了这种逻辑,结果是一样的 var mouseTimeout; document.body.onload = function () { const $ = document.querySelector.bind(document); $('.building').addEventListener(
光标:无
Dynamicly(使用javascript)在Chrome上的工作不一致。这在opera或firefox上运行良好。css实际上会改变,但光标不会隐藏!YouTube也使用了这种逻辑,结果是一样的
var mouseTimeout;
document.body.onload = function () {
const $ = document.querySelector.bind(document);
$('.building').addEventListener('mousemove', cursorHandler);
}
function cursorHandler() {
console.log('cursorHandler');
document.querySelector('.building').style.cursor = 'default';
console.log('show curser');
if (mouseTimeout) {
clearTimeout(mouseTimeout);
}
mouseTimeout = setTimeout(() => {
console.log('hide curser');
document.querySelector('.building').style.cursor = 'none';
}, 3000);
}
有人知道解决这个问题的好方法吗?不确定这是否有帮助,但当我打开Chrome开发者工具时,它并不一致。我一关上它,一切都按预期进行。 我使用一个透明的.gif文件作为光标。
干杯 不确定这是否有帮助,但当我打开Chrome开发者工具时,它并不一致。我一关上它,一切都按预期进行。 我使用一个透明的.gif文件作为光标。
干杯 显然,这是一个Chrome bug:不确定解决方案可能是什么,但我会尝试找到解决方案。尝试添加透明png图像可能是另一种选择。显然,这是一个Chrome bug:不确定解决方案可能是什么,我会尝试找到解决方案。尝试添加透明png图像可能是另一种选择。