Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a cursor image via jQuery?

Inside a web application I have a loading event. If the browser is loading data from the server, I want the cursor change to a gif that shows a clock. How can I change the cursor appearance. I only found this in the blog referring cursor apperance:

$(this).css('cursor','move');

I want to load an image instead.

like image 983
user1477955 Avatar asked Jun 30 '13 11:06

user1477955


1 Answers

Try this way:

$(this).css( 'cursor', 'url(cursor.png), auto' );

Here is JSFiddle: http://jsfiddle.net/fv3Bk/1/
The auto parameter tells what cursor type to use if cursor' image is not found. (See here more cursor types, here the example with another one )

like image 107
Ivan Chernykh Avatar answered Sep 28 '22 00:09

Ivan Chernykh