【发布时间】:2014-03-13 04:15:35
【问题描述】:
我正在尝试逐步增加所有 i 元素的动画延迟,但我似乎无法使语法正确。我晚上采取了正确的方法还是应该使用 js?干杯
http://codepen.io/2ne/pen/ycIpj
@for $i from 1 through 10 {
&:nth-child(#{$i}) {
animation-delay: (#{$i * 0.1})s;
}
}
【问题讨论】:
我正在尝试逐步增加所有 i 元素的动画延迟,但我似乎无法使语法正确。我晚上采取了正确的方法还是应该使用 js?干杯
http://codepen.io/2ne/pen/ycIpj
@for $i from 1 through 10 {
&:nth-child(#{$i}) {
animation-delay: (#{$i * 0.1})s;
}
}
【问题讨论】:
你应该把&改成li,看下面的代码:
@for $i from 1 through 10 {
li:nth-child(#{$i}) {
animation-delay:(#{$i*0.1s});
}
}
对于这样的标记:
<li></li>
<li></li>
...
“基础级规则不能包含父选择器引用字符'&'。”
【讨论】: