开发者

jQuery fadeTo() for colors

开发者 https://www.devze.com 2023-03-22 09:33 出处:网络
I want an equivalent of fadeTo() for colors, instead of opacity. For example, sta开发者_开发技巧rting with backgroundColor = \"red\", how can I gradually move to backgroundColor = \"green\" with jQue

I want an equivalent of fadeTo() for colors, instead of opacity.

For example, sta开发者_开发技巧rting with backgroundColor = "red", how can I gradually move to backgroundColor = "green" with jQuery?


You need to use jQuery UI Color Animation.

You may also use CSS3 transitions which I prefer. Not supported in Internet Explorer 9 or older. Will be supported in Internet Explorer 10.


You could use animate()

 $('#yourdiv').animate({ backgroundColor: "green" }, 1000)
0

精彩评论

暂无评论...
验证码 换一张
取 消