3 ms·
Instead of using margin, wouldn't translate be better? The image would still just scroll like normal if translate wasn't supported. Plus the processing would b
by spartanatreyu 13y ago
Instead of using margin, wouldn't translate be better?
The image would still just scroll like normal if translate wasn't supported. Plus the processing would be moved to the gpu and if the browser doesn't understand translate then it probably shouldn't be showing parallax pages. Nothing is worse then a jumpy site.
- dkuntz2 13y agoWhat is translate? From my really quick search it seems to be a canvas method, and I don't know that much about canvas, but I'm not sure if there's an easy way to implement it that keeps the simplicity of the script. My main goal was to have a functioning parallax effect that was reasonably simple.
- spartanatreyu 13y ago"Translate" is a part of css3's 2d transforms. Here's the mdn page: https://developer.mozilla.org/en-US/docs/Web/CSS/transform https://developer.mozilla.org/en-US/docs/Web/CSS/transform There's also a 3d version and if you set the z value to 0, the whole site looks the same and runs ridiculously better. here's the performance stats: http://jsperf.com/translate3d-vs-xy/28 http://jsperf.com/translate3d-vs-xy/28