parallax-scroll-component

1.0.4 • Public • Published

Parallax Scroll Component

A smooth parallax scrolling component for modern web applications.

Installation

npm install parallax-scroll-component

Usage

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

Options

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

Methods

  • next(): Go to next slide
  • prev(): Go to previous slide
  • goTo(index): Go to specific slide index

License

MIT

Package Sidebar

Install

npm i parallax-scroll-component

Weekly Downloads

12

Version

1.0.4

License

MIT

Unpacked Size

801 kB

Total Files

11

Last publish

Collaborators

  • shiyehao