ziad-saab / hw-parallax

Hardware-accelerated parallax scrolling plugin for jQuery
MIT License
39 stars 13 forks source link

hw-parallax

Hardware-accelerated scrolling parallax plugin for jQuery

The smooth parallax scrolling effect is achieved by using CSS 3D transforms where available. The system falls back to 2D transforms or even regular top and left positioning on older browsers.

TODO: make it work on touch scroll devices using iScroll 4

Basic usage

Check the demo directory or the demo page for a complete example using both tiled and regular backgrounds.

Dynamic pages / animations

hw-parallax does its work by creating new DOM elements that align with the blocks that have parallax. It already listens to resize events on the window object in order to reconfigure itself in case a responsive design moves or changes the size of blocks that have parallax.

Sometimes your own code will resize parallaxed blocks or move them around on the page. When this happens, you can signal hw-parallax to reconfigure itself by triggering the hwparallax.reconfigure event on the window object:

$(window).trigger('hwparallax.reconfigure');

Typically you would do that in the callback of your animation sequence.

Sites using this plugin