How to get cursor to change before mouse moves when changing the cursor style dynamically [duplicate]
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);
精彩评论