@blossom-carousel/web
v1.0.4
Published
A native-scroll-first carousel component for the web.
Maintainers
Readme
Blossom Carousel
A native-scroll-first carousel enhanced with drag support for Web.
Installation
npm install @blossom-carousel/web
import { BlossomCarousel } from "@blossom-carousel/web";
import "@blossom-carousel/core/style.css";CDN
<script src="https://unpkg.com/@blossom-carousel/web@latest/dist/blossom-carousel-web.umd.js"></script>
<link
rel="stylesheet"
href="https://unpkg.com/@blossom-carousel/web@latest/dist/web.css"
/>Usage
<blossom-carousel>
<div>Slide 1</div>
<div>Slide 2</div>
<div>Slide 3</div>
...
</blossom-carousel>Methods
Slide to the previous or next element.
use the align option to control the alignment of the target element. allowed values are "start" | "center" | "end"
⚠ when scroll-snap is active, the css scroll-snap-align value will be used and the align option will be ignored.
const carousel = document.getElementById("carousel");
carousel.prev({ align: "center" });
carousel.next({ align: "center" });