如果在基于Webkit的浏览器中未移动指针,鼠标光标不会改变 [英] Mouse cursor not changing if a pointer is not moved in Webkit-based browsers

查看:120
本文介绍了如果在基于Webkit的浏览器中未移动指针,鼠标光标不会改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们假设我们有简单的jQuery代码,如下所示:

Let's assume that we have simple jQuery code like the following:

var $document = $(document);
$document.ready(function() {
    var $test = $("#test");
    $document.keydown(function(e) {
        e.shiftKey && $test.css("cursor", "pointer");
    });
});

问题在于,如果将鼠标指针移到#test块上,然后按下Shift键,WebKit不会更改#test块的鼠标光标.但是,一旦移动光标,Chrome和Safari就会将光标样式更改为pointer-完全符合预期,但没有鼠标移动.这个错误(?)与Firefox无关,我没有在Internet Explorer和Opera下检查它.

The problem is that WebKit does not change the #test block mouse cursor if the mouse pointer is moved over the #test block, and the Shift key is pressed then. But as soon as you move the cursor, Chrome and Safari change the cursor style to pointer - exactly as it's expected but without mouse move. This bug (?) is not relevant to Firefox, and I didn't check it under Internet Explorer and Opera...

那么,有人遇到过同样的麻烦吗?也许,有针对性的解决方法吗?

So, did anyone have experience with the same trouble? Perhaps, is there a workaround for that?

谢谢.

推荐答案

这是当时Webkit引擎中的一个众所周知的错误,并且没有真正的解决方法.

This is a well known bug in then webkit engine, and there is no real workaround for it.

这篇关于如果在基于Webkit的浏览器中未移动指针,鼠标光标不会改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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