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

1.0.9 • Public • Published

simple-carousel

a simple carousel,without jQuery

Preview

live demo

Installation

npm install simple-carousel-js

Usage

import Carousel from 'simple-carousel-js';
 
const img = ['./1.jpg', './2.jpg', './3.jpg'];
 
const carousel = new Carousel(img, {
    // default options
    width: '100vw', // px、rem ...
    height: '50vh',
    element: '.carousel', // use document.querySelector(selector)
    duration: 1, // animation duration
    tween: 'Quart.easeOut', 
    pagination: true, // show pagination
    arrowButton: true, // show prev and next button
    momentum: 1, // turn to next page in a smaller number
    autoplay: true,
    autoplayDelay: 5,
    preventDefault: false,
    scale: false, // it's occurs when dragging
    // custom class name,string or string array
    customStyles: {
        imgClass: '',
        paginationClass: '',
        dotClass: '',
        prevButtonClass: '',
        nextButtonClass: '',
    },
});
 
// destroy,remove carousel html and event
carousel.destroy()

See tween

Also,you can use script tag

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.9
    2
    • latest

Version History

Package Sidebar

Install

npm i simple-carousel-js

Weekly Downloads

2

Version

1.0.9

License

MIT

Unpacked Size

94.5 kB

Total Files

16

Last publish

Collaborators

  • zhangyu1995