Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the Cursor for all objects in Javascript

Tags:

javascript

css

I am building an AJAX application that needs to change the cursor to a waiting cursor while waiting for the response to come in, and change back after. I know how to do that bit, but when the cursor is over links, or objects with custom cursors, those don't change, remaining as they were. Does anyone know how can I get the pointer to be the same for all objects temporarily?

like image 798
topherg Avatar asked Dec 12 '11 03:12

topherg


1 Answers

In JavaScript:

$('html').addClass('waiting');  // set waiting
// run ajax call... inside callback: 
$('html').removeClass('waiting');

In CSS:

html.waiting,
html.waiting * { cursor: wait !important; }
like image 141
Jason T Featheringham Avatar answered Nov 19 '22 02:11

Jason T Featheringham