gpt4 book ai didi

javascript - jquery仅在一个函数完成后才启动一个函数

转载 作者:行者123 更新时间:2023-11-28 01:54:16 24 4
gpt4 key购买 nike

我想知道是否可以在前一个函数完成后才启动一个函数。我有下面列出的两个函数,我正在尝试一个接一个地运行。谢谢!

                var controller = $.superscrollorama();


controller.addTween('#graphicOne', TweenMax.from( $('#graphicOne'), .7, {css:{right:'1000px'}, ease:Back.easeOut}));
controller.addTween('#graphicTwo', TweenMax.from( $('#graphicTwo'), .7, {css:{left:'1000px'}, ease:Back.easeOut}));
controller.addTween('#graphicThree', TweenMax.from( $('#graphicThree'), .7, {css:{right:'1000px'}, ease:Back.easeOut}));
}

函数2:

        function footerAnimation() {
TweenMax.from( $('#footerTextLight'), .7, {css:{opacity:'0'}})
}

最佳答案

使用onComplete回调

controller.addTween(
'#graphicThree',
TweenMax.from( $('#graphicThree'), .7,
{
css:{right:'1000px'},
ease:Back.easeOut,
onComplete : footerAnimation
}
)
);

Pass in a function to the tween for when the animation is complete.

http://johnpolacek.github.io/superscrollorama/

关于javascript - jquery仅在一个函数完成后才启动一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19346691/

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