1)选择更好的方法是什么?编译CSS或jQuery(推测jQuery)
2)我如何正确地将SASS转移到jQuery? (.shape是循环的类事件)
SASS
$elements: 120;
$base-color: gray;
@for $i from 0 to $elements {
.shape:nth-child(#{$i}) {
-webkit-animation-delay:-$i * 0.1s;
-moz-animation-delay:-$i * 0.1s;
animation-delay:-$i * 0.1s;
border-color:rgba(255,255,255,0.05);
z-index:$i;
}
}
的jQuery
for (var i = 1; i <= 120; i++) {
$(".shape :nth-child(1n+0)").delay(100);
}
答案 0 :(得分:0)
为什么要使用脚本来设置样式?适当的方式是使用CSS。
无论如何,如果你想/需要在jQuery中这样做:
for (var i = 1; i <= 120; i++) {
$(".shape :nth-child(1n+"+i+")").css('animation-delay', (i*0.1)+'s');
}