How to make the cursor change before mouse movement when changing the cursor style dynamically

I am changing the cursor dynamically by setting node.style.cursor = 'foo' when the item becomes selected. It seems that my cursor does not change until the mouse moves the pixel.

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

+3
javascript css
source share
1 answer

You can try using jQuery.

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

Or play with changing classes dynamically.

css will be:

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

javascript will be:

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

All Articles