有谁知道jQuery的可以处理像一个动画:的jQuery + RGBA颜色动画
rgba(0,0,0,0.2) → rgba(0,255,0,0.4)
我知道有一个plugin处理色彩的动画,但是这可能是太现代?
有谁知道jQuery的可以处理像一个动画:的jQuery + RGBA颜色动画
rgba(0,0,0,0.2) → rgba(0,255,0,0.4)
我知道有一个plugin处理色彩的动画,但是这可能是太现代?
恩,没关系。发现了一个惊人的修改jQuery颜色插件。
嗯,只是为那些感兴趣的人添加另一个随机coolness珍闻。 RGBA跨浏览器通过php图像生成:http://leaverou.me/2009/02/bulletproof-cross-browser-rgba-backgrounds/ – Matrym 2010-07-13 23:49:38
不幸的是,这个修改后的版本似乎不支持现代浏览器:( – 2013-01-16 14:55:06
您也可以使用CSS3动画达到同样的效果。见下文,
步骤1:使用动画规则:为动画
@keyframes color_up {
from {
background-color: rgba(0,0,0,0.2);
}
to {
background-color: rgba(0,255,0,0.4);
}
}
第2步创建一个关键帧。
animation-name: color_up;
animation-duration: 2s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-timing-function: ease-in-out;
DEMO:http://jsfiddle.net/2Dbrj/3/
的jQuery现在支持color动画与RGBA支持。这实际上是从一种颜色到另一种颜色的动画。
$(selector).animate({
backgroundColor: 'rgba(0,255,0,0.4)'
});
很好!谢谢! – 2013-01-16 16:58:09
@DjangoReinhardt使用CSS3更新了答案 – 2013-01-18 21:22:19
CSS3 JSFiddle似乎并不想在Chrome中工作,不过,谢谢! – 2013-01-19 03:45:57
使用jquery UI的句柄,$(object).animate({color : 'rgba(0,0,0,.2)'},500)
有用的答案了,在这个问题打上复制:http://stackoverflow.com/questions/4194745/changing-rgba -alpha-transparency-with-jquery – jedierikb 2012-08-13 19:16:16