Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 1022 Bytes

README.md

File metadata and controls

42 lines (31 loc) · 1022 Bytes

w3schools-carousel

See how to build a JavaScript carousel here

Installation

  1. run npm install
  2. run npm run watch
  3. open http://localhost:3000/

Usage

// Pass in the query selector string. E.g. "#carousel--1" and then an object full of options.
const carousel1 = new Carousel("#carousel--1", {
  wrap: true,
  interval: 4000,
  initialSlideIndex: 3,
  slideWidth: 400
});

// Get the DOM element.
const c3 = document.querySelector("#carousel--3");

// Initialize carousel by passing in the DOM element and the options object.
const carousel3 = new Carousel(c3, {
  wrap: false,
  interval: 2000
});

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Just for fun!

License

MIT