开发者

How to get cursor to change before mouse moves when changing the cursor style dynamically [duplicate]

This question already has answers here: Getting the browser cursor from "wait&q开发者_开发知识库uot; to "auto" without the user moving the mouse (14 answers) Closed 9 years ago.

I'm changing my cursor dynamically by setting node.style.cursor = 'foo' when an item becomes selected. It seems that my cursor doesn't change until the mouse moves a pixel.

Is there a way to tell the browser to change it immediately?


You can try with jQuery.

$(node).css('cursor', 'wait');

Or have a play with the changing of classes dynamically.

The css will be:

span.auto {cursor:auto}
span.wait {cursor:wait}

The javascript will be:

$(node).removeClass('auto');
$(node).addClass('wait);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜