Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 光标:无;不';不要总是在铬上工作_Javascript_Css_Google Chrome_Cursor_Mouse - Fatal编程技术网

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图像可能是另一种选择。