Why can't I change the background color of the "div" to "yellow",

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

why??

thank

+3
source share
3 answers

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

All animated properties must be numeric (except as noted below); properties that are not numeric cannot be animated using the core jQuery functionality. (For example, width, height, or left can be animated , but the background color cannot be .) Property values ​​are treated as a series of pixels unless otherwise specified. em and% units may be indicated where applicable.

, jQuery.color: http://plugins.jquery.com/project/color

+3
0

Source: https://habr.com/ru/post/1736050/


All Articles