While waiting for a response from a .load(), is there any way to change the cursor to the busy/wait cursor?
We can set the cursor to wait using object. style. cursor = “wait” in javascript.
The Windows wait cursor, informally the Blue circle of death (known as the hourglass cursor until Windows Vista) is a cursor that indicates that an application is busy performing an operation. It can be accompanied by an arrow if the operation is being performed in the background.
JavaScript cursor is a thing used as a mouse cursor whenever it's going to point on specific elements. There are various types of cursor available those are like wait, help, move, pointer, crosshair, cell, not allowed, zoom-in, zoom-out, etc. This cursor can be changed by assigning value to document. body.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With