A smooth parallax scrolling component for modern web applications.
npm install parallax-scroll-component
import ParallaxScroll from 'parallax-scroll-component';
const images = [
'path/to/image1.jpg',
'path/to/image2.jpg',
'path/to/image3.jpg'
];
const parallax = new ParallaxScroll('#container', {
images: images,
transitionDuration: 800, // optional, default 800ms
easing: 'ease-in-out' // optional, default 'ease-in-out'
});
// Programmatic control
parallax.next(); // Go to next slide
parallax.prev(); // Go to previous slide
parallax.goTo(1); // Go to specific index
Option | Type | Default | Description |
---|---|---|---|
images | Array | [] | Required. Array of image URLs |
transitionDuration | Number | 800 | Animation duration in milliseconds |
easing | String | 'ease-in-out' | CSS transition timing function |
-
next()
: Go to next slide -
prev()
: Go to previous slide -
goTo(index)
: Go to specific slide index
MIT