我有一组包含动画的 DIV,这些 DIV 在页面加载时被隐藏。这些动画中的每一个都在计时器上运行,但它们在 DIV 隐藏时运行。
这些 DIV 设置为在页面滚动时出现,但此时动画已经完成!有没有办法在它们出现后加载动画?
这是我的小提琴:http: //jsfiddle.net/fatfrank44/wRfu5/
CSS
#content-wrapper {
height: 500px;
float: left;
visibility: visible;
}
#container, #container2 {
width: 331px;
height: 105px;
margin: 15px;
background-color: #666;
}
.numbers {
width: 36px;
height: 50px;
background-color: #dc000f;
float: left;
}
HTML:
<div id="content-wrapper">
<div id="container">
<div class="numbers"></div>
</div>
<div id="container2">
<div class="numbers"></div>
</div>
</div>
JS:
<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>