jQuery的背景动画 [英] Jquery background animate

查看:167
本文介绍了jQuery的背景动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能进行动画处理的背景颜色 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 not background.

The color animations plugin for jQuery also does it.

Live Example: http://jsfiddle.net/thai/NXejr/2/

这篇关于jQuery的背景动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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