gpt4 book ai didi

jquery - 为什么我无法将 'div' 的背景颜色更改为 'yellow'

转载 作者:行者123 更新时间:2023-12-01 01:20:33 24 4
gpt4 key购买 nike

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

为什么?

谢谢

最佳答案

来自 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.

要设置颜色动画,请使用 jQuery.color 插件:http://plugins.jquery.com/project/color

关于jquery - 为什么我无法将 'div' 的背景颜色更改为 'yellow',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2406381/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com