当用户将鼠标悬停在链接上时,更改Chrome中的光标样式会失败 [英] Changing cursor style in Chrome fails when user is hovering over a link

查看:201
本文介绍了当用户将鼠标悬停在链接上时,更改Chrome中的光标样式会失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题,我在Chrome中看到。

I have a strange problem that i'm seeing in Chrome.

我使用ajax回调将光标的css样式设置为等待被点击。这在Firefox中完美工作,但在Chrome上,光标样式只有在我离开链接时才会改变 - 即当用户仍然悬停在链接上时样式不会改变。

I use an ajax callback to set the cursor's css style to "wait" when a sidebar link is clicked. This works perfectly in firefox, but on Chrome the cursor style only changes when I hover away from the link - i.e. the style doesn't change whilst the user is still hovered over the link

我做错了什么?下面是相关代码:

What am I doing wrong? Here's the relevant code:

// beforeSend callback
$('.ajax-link').bind('ajax:beforeSend', function() {
  $('body').css('cursor', 'wait');
  $('a').css('cursor', 'wait');  
  $('article.post').addClass('loading');    
});

// success callback    
$('.ajax-link').bind('ajax:success', function() {
  $('body').css('cursor', 'default');
  $('a').css('cursor', 'pointer');  
  $("article.post").html("<%= escape_javascript(render @post) %>");
});

正如你可以看到,我明确设置所有锚点的css也 $('a')。css('cursor','wait'); 这样它可以在firefox中工作,但Chrome似乎没有注意到这一点。

As you can see I am explicitly setting the css for all anchors too with $('a').css('cursor', 'wait'); so that it works in firefox but Chrome doesn't seem to take notice of this.

推荐答案

确定,这是Chrome和Safari的错误: http://code.google.com/p/chromium/issues/detail?id=26723

ok, it's a Chrome and Safari bug: http://code.google.com/p/chromium/issues/detail?id=26723

没有多少我可以做的,我想我可以只与它一起生活

not much I can do about it, I guess I can just live with it

这篇关于当用户将鼠标悬停在链接上时,更改Chrome中的光标样式会失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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