@snap-carousel/core

v0.0.13

SimplebarReact

Installation

- Via npm npm install @snap-carousel/core --save

- Via Yarn yarn add @snap-carousel/core

Usage

Check out the Demo project or our live Codesandbox example.

If you are using a module loader (like Webpack) you first need to load SimpleBar:

import { getActiveSnap, scrollTo, dragToScroll } from '@snap-carousel/core';
import '@snap-carousel/core/dist/styles.css';

const root = document.querySelector('.carousel');

const activeSnap = getActiveSnap({
  root,
  onChange: (snapIndex) => {
    console.log('active snap changed to: ', snapIndex);
  },
});

const activeSnapIndex = activeSnap.getActiveIndex();

scrollTo({ root, index: 2, duration: 0 });

Don't forget to import both css and js in your project!

npm i @snap-carousel/[email protected]

Metadata

  • MIT
  • Whatever
  • Unknown
  • released 12/24/2020

Downloads

Maintainers