开发者

mouse cursor change based on event

开发者 https://www.devze.com 2023-02-10 12:04 出处:网络
I have an ajax request that I\'m sending. When the request starts, I have document.body.style.cursor = \"wait\";

I have an ajax request that I'm sending. When the request starts, I have

  document.body.style.cursor = "wait";

which immediately changes the appearance of the cursor to a spinning circle.

When the request ends, I have

  document.body.style.cursor = "default";

However, this only returns the cursor to its original state when the user moves the mouse; if the mouse stays still, the cursor won't change. When you set it to "auto" or any other kind, the cursor change will only trigger when it moves开发者_JAVA技巧.

Any ideas?


just scroll window by 0,0.

document.body.style.cursor = "auto";
window.scroll(0, 0);
// tested in IE8 and FF3.6

And when the request ends, you need to set cursor to "auto", not a "default". You can see the difference on any element with text.


It's a chrome bug: http://code.google.com/p/chromium/issues/detail?id=26723

0

精彩评论

暂无评论...
验证码 换一张
取 消