Skip to content

Instantly share code, notes, and snippets.

@KB1RMA
Last active August 29, 2015 14:06
Show Gist options
  • Save KB1RMA/d698c85b6a01eb68a6bc to your computer and use it in GitHub Desktop.
Save KB1RMA/d698c85b6a01eb68a6bc to your computer and use it in GitHub Desktop.
Seriously improves CSS performance when manipulating elements with transforms. Particularly helpful when using Skrollr. Very nearly maintains 60FPS throughout scrolling.
/**
* Helps for anything we're going to be animating. Makes a HUGE
* difference
*
* Performance tweaks found here:
* http://blog.teamtreehouse.com/increase-your-sites-performance-with-hardware-accelerated-css
*
* NOTE: You'll want to use autoprefixer with this, otherwise you need to add the appropriate vendor prefixes
*
* -webkit-transform: translate3d(0, 0, 0);
* -moz-transform: translate3d(0, 0, 0);
* -ms-transform: translate3d(0, 0, 0);
* -webkit-perspective: 1000;
* -moz-perspective: 1000;
* -ms-perspective: 1000;
*/
@mixin performance() {
transform: translate3d(0, 0, 0);
backface-visibility: hidden;
perspective: 1000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment