Hong
Hong

Reputation: 18501

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.

Upvotes: 9

Views: 15282

Answers (1)

BiAiB
BiAiB

Reputation: 14122

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');
      }
    });
} );

Upvotes: 8

Related Questions