1
$(document).ready(function(){
    //other stuff
    $(".active_item").click(function() {
        $("body").css("cursor", "progress"); //tried wait instead of progress as well
        window.setTimeout(someLength,4000);//just to make sure we do switch back at some point
        $('#list tbody tr').each(function(i) {
            $(this).removeClass('invisible_row');
        });
        $("#list tbody tr").show();
        $('.catnav').each(function(i) {
            $(this).removeClass('current_category');
        });
        $("body").css("cursor", "default");
    });
});

I've checked other questions like Changing cursor to waiting in javascript/jquery

but in my code it doesn't work (the cursor does not change to "progress", or "wait" if I choose that one).

6
  • 2
    You're setting the cursor and then immediately setting it back. There's no net effect. Commented Oct 16, 2013 at 17:18
  • to put it another way, $("body").css("cursor", "progress").css("cursor", "default") would be identical to what you're currently doing with the cursor. Commented Oct 16, 2013 at 17:21
  • Oh I see, you mean because of the async functions? Commented Oct 16, 2013 at 17:21
  • the only async-ish function you have is the setTimeout, is that what you're referring to? Commented Oct 16, 2013 at 17:24
  • hmm. OK. So I set the cursor to progress. Then I call each, show, and each. I would like to set the cursor back when these three functions are done...But I am setting the cursor back before those three have finished. Is this the issue? Commented Oct 16, 2013 at 17:26

1 Answer 1

0

You could try and use the show() function as a timer, so that your cursor will stay in 'progress' at least a second.

$("#list tbody tr").show(1000 // Enter the time you want here , function(){$("body").css("cursor", "default");});

That way your cursor will reverse back to default after the function show() completes, which takes 1 second (in my example).

You can check .show() documentation for more information.

Sign up to request clarification or add additional context in comments.

1 Comment

I had tried this as well, but still there's no progress cursor. This even breaks my code for some reason...thanks anyway

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.