3
$('div').animate({ 'background':'yellow' }, 2000,'linear', function() {
        })

why??

thanks

zjm1126
  • 63,397
  • 81
  • 173
  • 221

3 Answers3

3

From jQuery API (http://api.jquery.com/animate/):

All animated properties should be numeric (except as noted below); properties that are non-numeric cannot be animated using basic jQuery functionality. (For example, width, height, or left can be animated but background-color cannot be.) Property values are treated as a number of pixels unless otherwise specified. The units em and % can be specified where applicable.

To animate color use jQuery.color plugin: http://plugins.jquery.com/project/color

Sasha Koss
  • 15,129
  • 4
  • 20
  • 27
0

In order to animate colors, you must include jQuery UI.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
0

You could try the jQuery color animations plugin.

Mottie
  • 84,355
  • 30
  • 126
  • 241