In my code, I use jQuery / CSS to set and disable the wait mouse cursor with the following code:
function setWaitCursor() { $('body').css('cursor', 'wait'); } function setDefaultCursor() { $('body').css('cursor', ''); }
I use this code to change the mouse pointer for a long operation:
setWaitCursor(); ... do stuff that takes a few seconds ... setDefaultCursor();
This code does not seem to work if you do not move the mouse (at least for Chrome on Win 10). If the mouse does not move after calling setDefaultCursor , the cursor displays the wait cursor until the mouse is moved (or vice versa).
Example: https://jsfiddle.net/antonyakushin/0jv6rqkf/
In this script, the cursor changes within 2 seconds after the link is clicked. If you do not move the mouse when you click on the link, the cursor does not change.
What is the best way to solve this problem, so that even if the mouse is not moved, the cursor changes?
javascript jquery css mouse
Anton
source share