Question

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

why??

thanks

Was it helpful?

Solution

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

OTHER TIPS

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

You could try the jQuery color animations plugin.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top