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

前端 未结 15 1993
自闭症患者
自闭症患者 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:53

    I would rather do it more elegantly like so:

    $(function(){  
      $("html").bind("ajaxStart", function(){  
         $(this).addClass('busy');  
       }).bind("ajaxStop", function(){  
         $(this).removeClass('busy');  
       });  
    });
    

    CSS:

    html.busy, html.busy * {  
      cursor: wait !important;  
    }  
    

    Source: http://postpostmodern.com/instructional/global-ajax-cursor-change/

提交回复
热议问题