jQuery:为输入字段设置动画文本颜色? [英] jQuery: animate text color for input field?

查看:32
本文介绍了jQuery:为输入字段设置动画文本颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段非常简单的代码,我认为它是让 jQuery 为给定输入字段设置文本颜色动画的正确方法.

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.

$('input').animate({color: '#f00'}, 500); 

但这行不通.但是,我可以更改文本颜色:

But it won't work. However, I can change the text color:

$('input').css('color', '#f00'); 

我在 Safari 4 和 Firefox 3.5 中都尝试过,但结果相同(缺乏).由于我的头发快用完了,我真的很感谢您对此问题的任何意见......谢谢.

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.

推荐答案

jQuery 不支持彩色动画,因此您需要 color 插件或 jQuery UI.两者都允许您使用用于背景颜色和颜色等属性的语法.

jQuery doesn't support color animations so you'll need the color plugin or, jQuery UI. Both allow you to use the syntax you're using for properties like background-color and color.

这篇关于jQuery:为输入字段设置动画文本颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆