Last active
March 21, 2018 09:46
-
-
Save loopdream/d8843258b97a57f26bc87e01606df3d5 to your computer and use it in GitHub Desktop.
Mixin for translate3d support with translate fallback
This file contains hidden or 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
// Translate3d uses GPU acceleration for increased performance with translate fallback | |
@mixin translate-x($value) { | |
will-change: transform | |
transform: translateX($value); | |
@supports (transform: translate3d($value, 0, 0)) { | |
transform: none; | |
transform: translate3d($value, 0, 0); | |
} | |
} | |
@mixin translate-y($value) { | |
will-change: transform | |
transform: translateY($value); | |
@supports (transform: translate3d(0, $value, 0)) { | |
transform: none; | |
transform: translate(0, $value, 0); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment