0

我有以下 2 个 JS 函数,我需要将它们组合起来,一个接一个。脚本 1 加载 DIV,第二个脚本是我要在 div 加载后播放的动画:

这是第一个:

<script>
    $(document).ready(function() {
        var controller = $.superscrollorama();
        // individual element tween examples
        controller.addTween('#container', TweenMax.fromTo( $('#container'), .25, {css:{opacity:0, scale:0, }, immediateRender:true, ease:Quad.easeInOut}, {css:{opacity:1, scale:1}, ease:Quad.easeInOut}));
        controller.addTween('#container2', TweenMax.fromTo( $('#container2'), .25, {css:{opacity:0, scale:0, }, immediateRender:true, ease:Quad.easeInOut}, {css:{opacity:1, scale:1}, ease:Quad.easeInOut}));
    });
</script>

这是第二个:

 <script>
$(document).ready(function () {
$('.numbers').delay(1).animate({
    'margin-left': '100px'
}, {
    duration: 1000,
    queue: true
});
});
</script>

小提琴:http: //jsfiddle.net/fatfrank44/wRfu5/2/

谢谢!

4

2 回答 2

0

除了 ComFreek 提到的关于您没有正确包含来自 GitHub(我已在 JSFiddle 中修复)的 Javascript 的内容外,您将比例和不透明度都设置为 0,这会使您的 div 从屏幕上“消失”。如果你解决了这个问题,那么你的动画就可以正常工作。

JSFiddle

css: {
    opacity: 1,
    scale: 1,
}
于 2013-09-10T19:34:50.227 回答
0

如果我正确理解您的问题,您只想这样做。

<script>
    $(document).ready(function() {
        var controller = $.superscrollorama();
        // individual element tween examples
        controller.addTween('#container', TweenMax.fromTo( $('#container'), .25, {css:{opacity:0, scale:0, }, immediateRender:true, ease:Quad.easeInOut}, {css:{opacity:1, scale:1}, ease:Quad.easeInOut}));
        controller.addTween('#container2', TweenMax.fromTo( $('#container2'), .25, {css:{opacity:0, scale:0, }, immediateRender:true, ease:Quad.easeInOut}, {css:{opacity:1, scale:1}, ease:Quad.easeInOut}));
        $('.numbers').delay(1).animate({
            'margin-left': '100px'
        }, {
            duration: 1000,
            queue: true
        });
    });
</script>
于 2013-09-10T19:12:22.607 回答