jQuery仅在一个函数完成后启动一个函数

jquery start a function only after one function completes

本文关键字:一个 函数 启动 jQuery      更新时间:2023-09-26

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

                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
                    }
                  )
       );

函数传递给补间,以便在动画完成时。

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