gpt4 book ai didi

jquery keydown动画背景颜色

转载 作者:行者123 更新时间:2023-12-01 07:22:22 25 4
gpt4 key购买 nike

我正在尝试简单地通过击键来制作背景动画。我无法使用以下方法让它工作:

$('input#userInput').live('keydown', function() { 
$(this).animate({backgroundColor:'#4E1402'}, 300).delay(800).animate({backgroundColor: '#555'}, 100);
});

请让我知道我哪里出错了。谢谢!

最佳答案

那是因为你can't animate background-color没有插件

All animated properties should be animated to a single numeric value, except as noted below; most 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, unless the jQuery.Color() plugin is used). Property values are treated as a number of pixels unless otherwise specified. The units em and % can be specified where applicable.

jsFiddle with the plugin

关于jquery keydown动画背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12434498/

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