Skip to content

Instantly share code, notes, and snippets.

@jkeen
Created November 11, 2015 05:05
Show Gist options
  • Save jkeen/fd2a933ef90fefbee04e to your computer and use it in GitHub Desktop.
Save jkeen/fd2a933ef90fefbee04e to your computer and use it in GitHub Desktop.
Excellent Transition Mixin
@mixin trans-prefix($value, $prefix: "") {
$slice: str-slice(inspect($value), 0, 9);
@if $slice == "transform" {
#{$prefix}transition: #{$prefix}#{$value};
} @else {
#{$prefix}transition: $value;
}
}
@mixin transition($properties...) {
@if length($properties) > 1 {
$spec: ();
@for $i from 1 through length($properties) {
$spec: append($spec, nth($properties, $i), comma);
}
} @else {
$spec: $properties;
}
@include trans-prefix($spec, -webkit-);
@include trans-prefix($spec, -moz-);
@include trans-prefix($spec);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment