gpt4 book ai didi

jquery - animate 的回调函数(完整)在开始时执行?

转载 作者:行者123 更新时间:2023-12-03 21:30:03 31 4
gpt4 key购买 nike

我正在使用 jQuery 1.5.1 这是我的代码:

$('.cellcontent').animate({
left: '-=190'}, {
easing: alert('start ani'),
duration: 5000,
complete: alert('end ani')});

我在动画开始之前收到两个警报!?我希望在动画结束后启动完整的功能。有什么想法吗?

最佳答案

我发现这有两个问题。

一,缓动应该是:

A string indicating which easing function to use for the transition

并且complete应该是一个函数。

http://api.jquery.com/animate

alert('start ani');
$('.cellcontent').animate({
left: '-=190'
},
{
easing: 'swing',
duration: 5000,
complete: function(){
alert('end ani');
}
});

关于jquery - animate 的回调函数(完整)在开始时执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5397260/

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