LHS Parallax
LHS Parallax plugin to make parallax animation when scrolling.
Installation
npm install @la-haute-societe/lhs-parallax
Usage
HTML
Create an HTML element with the scroll-level
attribute.
You can pass two attributes to your element :
-
scroll-level
- Parallax level (required) -
scroll-direction
- Parallax direction (optional) : x / y (default y),
<div class="myElement" scroll-level="3" scroll-direction="x"></div>
JavaScript
Import LhsParallax where you want to use it.
Then get the HTML element and create an instance of LhsParallax passing your element in parameter.
import LhsParallax from '@la-haute-societe/lhs-parallax';
var myElement = document.querySelector('.myElement');
var scroll = new LhsParallax(myElement);