Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

html

jquery

css

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

like image 644
Takkun Avatar asked Apr 26 '12 03:04

Takkun


People also ask

How do I change my cursor to wait?

We can set the cursor to wait using object. style. cursor = “wait” in javascript.

What is cursor wait?

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.

What is cursor in JavaScript?

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.


1 Answers

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

like image 200
iambriansreed Avatar answered Oct 11 '22 15:10

iambriansreed