Skip to content

Instantly share code, notes, and snippets.

@loopdream
Last active March 21, 2018 09:46
Show Gist options
  • Save loopdream/d8843258b97a57f26bc87e01606df3d5 to your computer and use it in GitHub Desktop.
Save loopdream/d8843258b97a57f26bc87e01606df3d5 to your computer and use it in GitHub Desktop.
Mixin for translate3d support with translate fallback
// 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