gpt4 book ai didi

jquery - 应用样式前查询、完成动画

转载 作者:太空宇宙 更新时间:2023-11-04 12:47:33 25 4
gpt4 key购买 nike

我有这个动画。将 div 移到左侧后,我想添加“拉直”类,但它会立即添加,因此永远不会看到过渡。

是否可以在移动完成后添加类?

$('li.current .imageblock').css({
left: '-300px'
}).animate({
left: '60%'
}, {
duration: 500
}).addClass("straighten").delay(3500).animate({
left: '100%'
}, {
duration: 500
})

工作示例 http://www.tomatedesign.com/stothers/

最佳答案

你应该为 .animate() 使用 'complete' 选项

$('li.current .imageblock').css({left:'-300px'}).animate({left:'60%'},{duration:500,complete:function(){

$(this).addClass("straighten").delay(3500).animate({left:'100%'},{duration:500 });

}
});

关于jquery - 应用样式前查询、完成动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26373611/

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