jln13x / embla-carousel-snap-class

A plugin for Embla Carousel that adds a class to the snapped slide. Related discussion: https://github.com/davidjerleke/embla-carousel/discussions/374

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Embla Carousel Snap Class

Snap Preview

Inspired by embla-carousel-class-names

A plugin for Embla Carousel that adds a class only to the snapped slide.

Setup

npm install embla-carousel-snap-class
import SnapClass from "embla-carousel-snap-class"

const emblaContainer = document.querySelector(".embla") as HTMLElement;
Embla(emblaContainer, {}, [SnapClass()]);

Options

The Plugin accepts the following options:

{
    <!-- Changes the name of the class added to the snapped slide -->
    className: string
}

About

A plugin for Embla Carousel that adds a class to the snapped slide. Related discussion: https://github.com/davidjerleke/embla-carousel/discussions/374


Languages

Language:TypeScript 100.0%