如何 运行 两个 Jquery 动画同时链接?
How to run two Jquery animates with chaining simultaneously?
我想让一个对象来回移动,同时对象改变它的不透明度。
我尝试使用队列和回调函数来完成这项工作。
$(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")
})
});
对象左右移动,然后改变不透明度。
您可以一次为多个属性设置动画,如下所示:
$(document).ready(function(){
$(".button").click(function(){
$("#divv").animate({left:'+500', opacity:'-=0.8'}, "slow", "linear");
});
});
希望这有效!
我想让一个对象来回移动,同时对象改变它的不透明度。
我尝试使用队列和回调函数来完成这项工作。
$(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")
}) });
对象左右移动,然后改变不透明度。
您可以一次为多个属性设置动画,如下所示:
$(document).ready(function(){
$(".button").click(function(){
$("#divv").animate({left:'+500', opacity:'-=0.8'}, "slow", "linear");
});
});
希望这有效!