[英]How to apply two animations to the same element simultaneously?
I'm trying to apply two animations with different easings simultaneously to the same element but I can't get it to work. 我正在尝试将具有不同缓动效果的两个动画同时应用于同一元素,但无法使其正常工作。 This is what I tried:
这是我尝试的:
$(window).load(function() {
var speed = 1500;
var delay = 0;
for(var i = 0 + 1; i <= $('.skills li').length; i++) {
var li = $('.skills li:nth-child(' + (i + 1) + ')');
li.delay(delay).animate({
left: "0"
},{
duration: speed,
queue: false,
easing: 'easeOutBounce'
});
li.delay(delay).animate({
opacity: 1
},{
duration: speed,
queue: false,
easing: 'easeOut'
});
delay += 150;
};
});
Thanks in advance! 提前致谢!
You can add more than one property change parameter into animation object. 您可以在动画对象中添加多个属性更改参数。
for (var i = 0; i <= $('.skills li').length; i++) {
var li = $('.skills li:nth-child(' + (i + 1) + ')');
li.stop(true, true).delay(i * 150).animate({
left: "0",
opacity: 1
}, {
duration: speed,
queue: true, //do you want one-by-one or all together , please specify?
specialEasing: {
width: "linear",
height: "easeOutBounce"
}
});
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.