Getting the browser cursor from “wait” to “auto” without the user moving the mouse

前端 未结 15 1929
自闭症患者
自闭症患者 2020-11-27 13:49

I use this jQuery code to set the mouse pointer to its busy state (hourglass) during an Ajax call...

$(\'body\').css(\'cursor\', \'wait\');

相关标签:
15条回答
  • 2020-11-27 13:58

    HERE is my solution:

    function yourFunc(){
    
    $('body').removeClass('wait'); // this is my wait class on body you can $('body').css('cursor','auto');
    $('body').blur();
    $('body').focus(function(e){
    $('body')
     .mouseXPos(e.pageX + 1)
     .mouseYPos(e.pageX - 1);
    });
    
    }
    
    0 讨论(0)
  • 2020-11-27 13:58

    I haven't tried this, but what about if you create a transparent div that is absolutely positioned and fills the viewport just before changing the CSS. Then, when the css is changed on the body, remove the div. This might trigger a mouseover event on the body, which might cause the cursor to update to the latest CSS value.

    Again, I haven't tested this, but it's worth a shot.

    0 讨论(0)
  • 2020-11-27 14:06

    It is a bug in both browsers at the moment. More details at both links (in comments as well):

    http://code.google.com/p/chromium/issues/detail?id=26723

    and

    http://code.google.com/p/chromium/issues/detail?id=20717

    0 讨论(0)
  • 2020-11-27 14:07

    I don't think you'll be able to do it.

    However, try changing the scroll position; it might help.

    0 讨论(0)
  • 2020-11-27 14:08

    I believe this issue (including the mousedown problem) is now fixed in Chrome 50.

    But only if you are not using the developer tools!!

    Close the tools and the cursor should immediately respond better.

    0 讨论(0)
  • 2020-11-27 14:08

    $('*').css('cursor','wait'); will work everywhere on the page including links

    0 讨论(0)
提交回复
热议问题