jQuery:为输入字段设置动画文本颜色?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1354277/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jQuery: animate text color for input field?
提问by John Foster
I've got this really simple piece of code that I thought was the correct way to get jQuery to animate the text color for a given input field.
我有一段非常简单的代码,我认为这是让 jQuery 为给定输入字段设置文本颜色动画的正确方法。
$('input').animate({color: '#f00'}, 500);
But it won't work. However, I can change the text color:
但它不会工作。但是,我可以更改文本颜色:
$('input').css('color', '#f00');
I've tried this in both Safari 4 and Firefox 3.5 with the same (lacking) results. I'd really appreciate any input on this problem as I'm running out of hair... Thanks.
我已经在 Safari 4 和 Firefox 3.5 中尝试过这个,但结果相同(缺乏)。我真的很感激关于这个问题的任何意见,因为我的头发快用完了......谢谢。
回答by John Foster
回答by matadur
回答by redsquare
To animate color you need the jquery color plugin.
要动画颜色,您需要jquery 颜色插件。
回答by n1313
You'll need Color Animations pluginfor this
为此,您需要Color Animations 插件
回答by kaiz.net
I found the color plugin to be extremely flaky from one page load to another, even on a static page with the exact same code..! ColorBlend did the job perfectly time though. http://plugins.jquery.com/files/jquery.colorBlend.js_6.txt
我发现颜色插件从一个页面加载到另一个页面非常不稳定,即使在具有完全相同代码的静态页面上..!不过,ColorBlend 完美地完成了这项工作。 http://plugins.jquery.com/files/jquery.colorBlend.js_6.txt