Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the cursor to default on loading

I have the following code to change the cursor when a hyperlink is clicked

        $('a').click(function () {
            $('*').css("cursor", "progress");
        });

When a link is clicked, the cursor changes to "progress" (i.e. wait cursor) exactly as expected. However, the problem is that the cursor remains "progress" after a new page is loaded. It changes to default only after the mouse moves. This is related to another question. Others expressed the same problem.

As described by the title, I hope to change the cursor to default when a page is loaded.

like image 336
Hong Avatar asked Apr 19 '11 14:04

Hong


1 Answers

You didn't clearly specify how it's meant to be used but here's an example of how to perform the behaviour you describe with an ajax call:

$('a').click(function () {
    $('body').css('cursor', 'progress');
    $.ajax({
      url: "test.html",
      context: document.body,
      complete: function(){
       $('body').css('cursor', 'default');
      }
    });
} );
like image 138
BiAiB Avatar answered Sep 19 '22 17:09

BiAiB