lesscs中的循环

lesscs中的循环,less,Less,我有4列,希望每列有不同的转换时间 我尝试了这段代码,但是css文件渲染不适合我的选项 结果是: .whatWeDoLoop(@counter) when (@counter > 0) { .whatWeDoLoop((@counter - 1)); // next iteration .st-theme-icon:nth-child(2n+@counter) { -webkit-transition: all (0.3s * @counter) 0.

我有4列,希望每列有不同的转换时间

我尝试了这段代码,但是css文件渲染不适合我的选项

结果是:

.whatWeDoLoop(@counter) when (@counter > 0) {
    .whatWeDoLoop((@counter - 1));    // next iteration
    .st-theme-icon:nth-child(2n+@counter) {
        -webkit-transition: all (0.3s * @counter) 0.3s;
    }
}
.whatWeDoLoop(4); // launch the loop
.st-theme-icon {
    -webkit-transform: translate(0, 10px);
    opacity: 0;
    filter: alpha(opacity=0);
}
.css3-effect .st-theme-one-page-visible .st-theme-icon {
    -webkit-transform: translate(0, 0);
    opacity: 1;
    filter: alpha(opacity=1);
}

使其成为
.st主题图标:第n个子(2n+@{counter})
:)您正在使用一个变量来形成选择器(插值),因此需要
{}
。谢谢。你能更好地优化我的代码吗?你的循环已经很好了。第二部分可以通过使用参数mixin进行优化,因为属性相同,只有值会更改。是的,感谢您对第二部分的评论。
.st-theme-icon:nth-child(2n+@counter){-webkit-transition:all(0.3s) 0.3s;}