【发布时间】:2015-05-27 13:31:16
【问题描述】:
我正在尝试运行一个 sass 函数:
$times: 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.75 0.80 0.90;
@each $value in $times{
.is-hidden-#{$value}{
@include hide( $value + s );
}
}
问题是这样的:不知何故,它不接受十进制数字。它与 1、2、3 等完美配合。我什至试过这个:
$times: 10 20 30 40 50 60 70 80 90;
@each $value in $times{
.is-hidden-#{$value}{
@include hide( ($value / 100) + s );
}
}
但是 sass 并没有对最后的计算做任何事情。他只是忽略了'/ 100'。有什么方法可以通过这样的函数传递十进制数吗?输出是这样的:
.is-hidden-0.1s{
}
.is-hidden-0.2s{
}
.is-hidden-0.3s{
}
etc....
谢谢!
--- 编辑 --- 这是 hide mixin:
@mixin hide( $time ){
opacity: 0;
visibility: hidden;
@include transition( $time );
}
【问题讨论】:
-
你试过了吗:
@include hide(#{$value}#{s})) -
能不能把
hidemixin的代码也发一下?
标签: sass