1.6.1 • Published 4 years ago

latte-carousel v1.6.1

Weekly downloads
21
License
MIT
Repository
github
Last release
4 years ago

Build Status npm npm

About

LatteCarousel is a lightweight and responsive carousel without any dependencies.

Usage

<!-- Package -->
<link rel="stylesheet" href="latte-carousel.min.css" />
<script src="latte-carousel.min.js"></script>

<!-- CDN -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/latte-carousel@1.6.1/dist/latte-carousel.min.css" />
<script src="https://cdn.jsdelivr.net/npm/latte-carousel@1.6.1/dist/latte-carousel.min.js"></script>
<div class="latte-carousel" id="carousel">
    <div class="latte-item"></div>
    <div class="latte-item"></div>
    <div class="latte-item"></div>
    <div class="latte-item"></div>
</div>
var options = {
    count: 3,
    move: 1,
    touch: true,
    mode: "align",
    buttons: true,
    dots: true,
    rewind: true,
    autoplay: 0,
    animation: 500,
    responsive: {
        "0": { count: 1.5, mode: "free", buttons: false },
        "480": { count: 2.5, mode: "free", buttons: false },
        "768": { count: 3, move: 3, touch: false, dots: false },
        "1440": { count: 4, move: 2, touch: false, dots: false },
    },
};

var carousel = new latte.Carousel("#carousel", options);

// Trigger events
carousel.trigger("next");
carousel.trigger("previous");

carousel.trigger("goto", 0);

carousel.trigger("update");

carousel.trigger("remove");

// Listen events
carousel.on("move", () => {});
carousel.on("moved", () => {});

carousel.off();

You can also include latte-carousel using ES6 import and Babel or Webpack.

This package already includes .d.ts files.

Options

NameTypeDefaultDescription
countNumber3Number of visible items
moveNumber1Number of items to scroll
touchBooleanfalseEnable touch support
modeString align, free"align"Align animation to grid (touch only)
buttonsBooleantrueEnable carousel buttons
dotsBooleanfalseEnable carousel dots
rewindBooleantrueEnable rewind at the end (or start)
autoplayNumber0Autoplay time in millis (0 to disable)
animationNumber500Animation time in millis
responsiveMap<String, Object>undefinedMap of options for each breakpoint

Features

  • Responsive options
  • Touch support
  • Stage padding
  • Navigation dots
  • Rewind carousel
  • Autoplay carousel
  • Carousel events

Browser Support

This library is tested on Google Chrome, but it should work on all major browsers with CSS3 and ES5 support (including IE9+).

Build

Install dependencies:

yarn install

Build project:

yarn run build

Run example:

yarn run serve

open http://localhost:8080/example

Result files:

  • dist/latte-carousel.min.css
  • dist/latte-carousel.min.js
1.6.1

4 years ago

1.5.6

5 years ago

1.5.5

5 years ago

1.5.4

5 years ago

1.5.3

5 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.9.0

6 years ago