How to change cursor to wait when using jQuery .load()

后端 未结 8 592
孤街浪徒
孤街浪徒 2020-12-08 13:35

While waiting for a response from a .load(), is there any way to change the cursor to the busy/wait cursor?

8条回答
  •  时光说笑
    2020-12-08 13:44

    Try:

    Updated to work with jQuery 1.8 +

    $(document).ajaxStart(function() {
        $(document.body).css({'cursor' : 'wait'});
    }).ajaxStop(function() {
        $(document.body).css({'cursor' : 'default'});
    });
    

    Cursor changes on any ajax start and end. That includes .load().

    Try out the different cursor styles here:

    https://developer.mozilla.org/en-US/docs/Web/CSS/cursor

提交回复
热议问题