how to use !important in jQuery animate() function

You just cannot do this.

As per jQuery documentation...

"All animated properties should be animated to a single numeric value... ... most properties that are non-numeric cannot be animated using basic jQuery functionality..."

http://api.jquery.com/animate/


I strongly recommend re-examining your need for !important.


You can use css transition to make it work, because css transition will work even if the style attribute is changed by $(elem).attr('style', '...');

you use:

js

// the element you want to animate
$(elem).attr('style', 'your_style_with_important');

css

elem {
    transition: all 0.2 linear;
    -moz-transition: all 0.2 linear;
    -webkit-transition: all 0.2 linear;
}