mini-parallax
Parallax library contains both normal parallax and background parallax.
Written in vanilla JavaScript. It's lightweight.
Demo
Installation
ES Modules
npm i mini-parallax
CDN
unpkg (3.6 KB)
const NormalParallax BackgroundParallax = MiniParallax
MiniParallax
is global object containing NormalParallax
and BackgroundParallax
class.
Usage
NormalParallax
class
'.js-parallax' speed: 003
<!-- Set speed only for this element -->
If you disable autoRun
, run it at any time you like.
const parallax = '.js-parallax' autoRun: false window
If the text is in the parallax element, it will blur, so set the isRound
option to true
.
'.js-parallax' isRound: true
BackgroundParallax
class
It automatically calculates the position of the background element from the height of the parent element and the background element.
'.js-background-parallax'
Browsers support
IE / Edge |
Firefox |
Chrome |
Safari |
iOS Safari |
---|---|---|---|---|
IE11, Edge | last version | last version | last version | last version |
If you want more features, please consider other parallax libraries.