jQuery的背景动画 [英] Jquery background animate
问题描述
是否有可能进行动画处理的背景颜色
jQuery的,因为它不工作。
$('#东西)。动画({
背景:红
},1000);
从文档,
借助 jQuery UI的项目允许一些非扩展了
.animate()
方法-numeric风格,如颜色进行动画。该项目还包括一个用于指定通过CSS类的动画,而不是个别属性的机制。
块引用>所以,如果你使用jQuery UI,可以动画背景颜色。只要确保你使用
的backgroundColor
,而不是背景
。插件动画的jQuery也做了。
活生生的例子: http://jsfiddle.net/thai/NXejr/2/
Is it possible to animate the
background-color
in jQuery, because it is not working.$('#something').animate({ background :"red" }, 1000);
解决方案From the docs,
The jQuery UI project extends the
.animate()
method by allowing some non-numeric styles such as colors to be animated. The project also includes mechanisms for specifying animations through CSS classes rather than individual attributes.So if you use jQuery UI, you can animate background colors. Just make sure that you use
backgroundColor
and notbackground
.The color animations plugin for jQuery also does it.
Live Example: http://jsfiddle.net/thai/NXejr/2/
这篇关于jQuery的背景动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!