Created
November 11, 2015 05:05
-
-
Save jkeen/fd2a933ef90fefbee04e to your computer and use it in GitHub Desktop.
Excellent Transition Mixin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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