If I have a LESS parametric mixin such as:
.trans (@what: all, @time: 0.2s, @type: ease-in-out) {
-webkit-transition: @arguments;
-moz-transition: @arguments;
-o-transition: @arguments;
-ms-transition: @arguments;
transition: @arguments;
}
It works as expected:
.myItem {
.trans;
}
But if I want to set the @time to 0.4s, I seem to have to pass an argument for the first item as well:
.trans(all, 0.4s);
Is there a syntax for just passing a null argument, so the default ("all") is simply used? This does not work, throws an error on compile:
.trans(,0.4s);
Thanks.
Probably too late, but the response could be useful to others.
You can also name the variables when you're calling the mixin, without having to follow the order.
Considering your case:
.trans (@what: all, @time: 0.2s, @type: ease-in-out) {
-webkit-transition: @arguments;
-moz-transition: @arguments;
-o-transition: @arguments;
-ms-transition: @arguments;
transition: @arguments;
}
You could do something like .trans(@time:1s); or .trans(@type:linear, @what: opacity);
hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With