Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery .css() fallbacks?

What is the proper way to do fallbacks with .css()? This would most commonly be used for font fallbacks but I am using it for cursor images.

Here's what I got that isn't working:

$("#dragable").css('cursor','url(images/grabbing.gif), -moz-grabbing, auto');

**UPDATE: can someone tell me the valid CSS for starters?

What I have:

cursor: url(images/grabbing.gif), -moz-grabbing, auto;

... doesn't work.**

like image 869
Dave Avatar asked Nov 23 '10 22:11

Dave


1 Answers

Using dynamic inline styles not always a good idea. Consider dynamic classes. Define somewhere in css specific class for draggable element:

.cur-draggable { cursor: url(images/grabbing.gif), -moz-grabbing, auto; }

And try to add this class, instead of style itself;

$("#dragable").addClass('cur-draggable');
like image 193
vtambourine Avatar answered Sep 27 '22 18:09

vtambourine