Nonlinear Performance Magnification

    embla-carousel-wheel-gestures
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.1 • Public • Published

    Embla Carousel

    Wheel Gestures for Embla Carousel

    This plugin adds wheel interactions to the amazing Embla Carousel

    NPM

    Installation

    First you need to follow the installation instructions for Embla Carousel, after that you can add wheel support:

    yarn add embla-carousel-wheel-gestures # npm install --save embla-carousel-wheel-gestures

    JavaScript / TypeScript

    import EmblaCarousel from 'embla-carousel'
    import { setupWheelGestures } from 'embla-carousel-wheel-gestures'
    
    // initialize Embla Carousel
    const embla = EmblaCarousel(emblaNode, options)
    
    // add support for wheel events
    setupWheelGestures(embla)

    React

    import { useEmblaCarousel } from 'embla-carousel-react'
    import { setupWheelGestures } from 'embla-carousel-wheel-gestures'
    
    const EmblaCarouselComponent = ({ children }) => {
      const [emblaRef, embla] = useEmblaCarousel({ loop: false })
    
      useEffect(() => embla && setupWheelGestures(embla), [embla])
    
      // ...
    }

    Examples

    Get started instantly with one of the CodeSandboxes below.

      JavaScript / TypeScript

      React (embla-carousel-react)

    OS & Browser Support

    • Mac OS (Chrome, Firefox, Safari, Edge), Magic Mouse, Magic Trackpad
    • Windows (Chrome, Firefox, Edge), Microsoft Precision Touchpads

    Legacy Browsers

    If you need to support IE 10 & 11 you might need to install and add extra polyfills:

    // Adds support old IE >= 10
    import 'core-js/stable'
    import 'events-polyfill/src/constructors/MouseEvent'

    Thanks

    Kudos to David Cetinkaya for creating Embla Carousel with its open API 🙏

    License

    MIT.

    Install

    npm i embla-carousel-wheel-gestures

    DownloadsWeekly Downloads

    4,279

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    49.3 kB

    Total Files

    17

    Last publish

    Collaborators

    • xiel