ScrollParallaxJS
Light weight Javascript text splitter
ScrollParallaxJS is an easy to use parallax on scroll package. It allow user friendly parallax setings via HTML data-attributes. Only two lines of javascript, non-mandatory custom options, HTML class & attributes and you'r ready to go.
Example — Repository — Questions
Usage
Download the file and include it in your HTML
Or install and import it as a module
$ npm install scroll-parallax-js
First, import ScrollParallaxJS :
;
Then, use ScrollParallaxJS :
<!-- You have to wrap your animated elements with .scrollparallaxjs__wrapper --> <!-- You have to use .scrollparallaxjs__el on animated elements --> <!-- Define animations on scroll with scrollparallaxjs data attributes -->
The css is entirely yours, but you can use my example :
// Select the DOM element wich contains the target animationconst container = document; // Define the container of the parallax and add optionsconst containerParallax = container simultaneous: false ;
Options
ScrollParallaxJS comes with multiples options :
duration: '100%' triggerHook: 0 offset: 0 pinned: true indicators: false simultaneous: true prefix: 'scrollparallaxjs'
You can overwrite theses options when you create a new parallax :
const container = document;const scrollParallax = container duration: 50% pinned: false prefix: 'custom-prefix' ;