我想让一个对象来回移动,同时该对象同时改变其不透明度。
我尝试使用队列和回调函数使之工作。
$(document).ready(function(){
$(".button").click(function(){
$("#divv").animate({left:'+=500'},"slow","linear")
.animate({left:'-=500'},"slow","linear")
.animate({left:'-=500'},"slow","linear")
.animate({left:'+=500'},"slow","linear")
$("#divv").animate({opacity:'-=0.8'},"slow","linear")
.animate({opacity:'+=0.8'},"slow","linear")
.animate({opacity:'-=0.8'},"slow","linear")
.animate({opacity:'+=0.8'},"slow","linear")
}) });
对象向左和向右移动,然后更改不透明度。
答案 0 :(得分:0)
您可以一次为多个属性设置动画,如下所示:
$(document).ready(function(){
$(".button").click(function(){
$("#divv").animate({left:'+500', opacity:'-=0.8'}, "slow", "linear");
});
});
希望这行得通!