【发布时间】:2016-09-19 03:39:00
【问题描述】:
我是 CSS 动画的初学者。
我连续有很多元素(使用引导程序 - 然后每个分辨率的元素数量不同)
<div class="row IconAnimate">
<div class="col-xs-12 col-sm-4 col-lg-2">
<div><i class="fa fa-trademark fa-3x"></i>
<h4><strong>TITLE 1</h4>
<p>BLA BLA BLA</p>
</div>
</div>
<div class="col-xs-12 col-sm-4 col-lg-2">
<div><i class="fa fa-paint-brush fa-3x"></i>
<h4><strong>TITLE 2</strong></h4>
<p>BLA BLA BLA</p>
</div>
</div>
</div>
有了这个,我有 6、3 和 1 个元素的行。 (col-xs-12、sm-4 和 lg-2)- 好吗?
每一行都有一个向下滚动动画(由“animation-element side-left”创建)
换句话说,如果我向下滚动浏览器,该行将被动画化。
到目前为止 - 没有问题。
现在我想为图标设置动画(在本例中为“FA-TRADEMARK”图标)
带有淡入动画。
但是..
我的问题:
如何在每个图标之间延迟 3 秒为每个图标设置动画?
我知道了:
@keyframes FadeIn {
0% { opacity:0; transform:scale(.1);}
85% {opacity:1; transform:scale(1.05);}
100% {transform:scale(1); }
}
.IconAnimate i { animation: FadeIn 1s linear; animation-fill-mode:both; }
.IconAnimate i:nth-child(1){ animation-delay: 3s }
.IconAnimate i:nth-child(2){ animation-delay: 6s }
.IconAnimate i:nth-child(3){ animation-delay: 9s }
.IconAnimate i:nth-child(4){ animation-delay: 12s }
但是通过这段代码我得到了动画,但是,我需要知道我在一行中有多少个元素。
如果我不知道每行有多少元素,有没有办法制作动画?
JSFIDDLE:https://jsfiddle.net/mydjnfLn/
【问题讨论】:
-
你可能想使用javascript?
-
@vahid 嗨!是的,javascript没问题!但是如何..:D
标签: javascript jquery html css animation