luna-carousel
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Luna Carousel

Lightweight carousel.

Demo

https://luna.liriliri.io/?path=/story/carousel

Install

Add the following script and style to your page.

<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-carousel/luna-carousel.css" />
<script src="//cdn.jsdelivr.net/npm/luna-carousel/luna-carousel.js"></script>

You can also get it on npm.

npm install luna-carousel --save
import 'luna-carousel/luna-carousel.css'
import LunaCarousel from 'luna-carousel'

Usage

const container = document.getElementById('container')
const carousel = new LunaCarousel(container, { interval: 5000 })
carousel.append('<div style="background:#e73c5e;">ITEM 1</div>')

Configuration

  • interval(number): Time between automatically cycling.

Api

cycle(): void

Cycle through the carousel items.

pause(): void

Stop cycling.

prev(): void

Slide to the previous item.

next(): void

Slide to the next item.

slideTo(idx: number): void

Slide to the item at given index.

append(content: string | HTMLElement): void

Append item.

insert(pos: number, content: string | HTMLElement): void

Insert item at given position.

Readme

Keywords

Package Sidebar

Install

npm i luna-carousel

Weekly Downloads

2

Version

0.2.0

License

MIT

Unpacked Size

172 kB

Total Files

12

Last publish

Collaborators

  • surunzi