在互联网上搜索后,似乎有多种方法可以通过jquery为颜色添加动画。
让我的“包装器”背景色从#FFF到#000的动画效果最好的方法是什么?
var open = true;
$(".btn-slide").click(function(){
if(open){
$("#wrapper").animate({
width: 900,
},
1000, function() {
});
open= false;
}else{
$("#wrapper").animate({
width: 250,
},
1000, function() {
open = true; }
});谢谢你的建议。我非常感谢您的投入。
发布于 2011-11-16 18:10:54
你可以试试这个
var open = true;
$(".btn-slide").click(function(){
if(open){
$("#wrapper").animate({
width: 900,
backgroundColor: '#000'
},
1000, function() {
});
open= false;
}else{
$("#wrapper").animate({
width: 250,
backgroundColor: '#000'
},
1000, function() {
open = true; }
}); 发布于 2011-11-16 18:10:55
你会使用jQuery animate。
但是,默认情况下,jQuery不能插入颜色,因此您需要使用color animation plugin或(如Niklas所述) jQuery UI Effects。
https://stackoverflow.com/questions/8149795
复制相似问题