gpt4 book ai didi

javascript - 如何同时运行两个 jQuery 动画?

转载 作者:IT老高 更新时间:2023-10-28 13:14:11 26 4
gpt4 key购买 nike

是否可以同时在两个不同的元素上运行两个动画?我需要这个问题的反面Jquery queueing animations .

我需要做这样的事情......

$('#first').animate({ width: 200 }, 200);
$('#second').animate({ width: 600 }, 200);

但同时运行这两个。我唯一能想到的就是为每个动画使用一次 setTimeout,但我认为这不是最好的解决方案。

最佳答案

是的,有!

$(function () {
$("#first").animate({
width: '200px'
}, { duration: 200, queue: false });

$("#second").animate({
width: '600px'
}, { duration: 200, queue: false });
});

关于javascript - 如何同时运行两个 jQuery 动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1251300/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com