8.0.0-rc05 • Published 7 months ago

embla-carousel-wheel-gestures v8.0.0-rc05

Weekly downloads
706
License
MIT
Repository
github
Last release
7 months ago

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 { WheelGesturesPlugin } from 'embla-carousel-wheel-gestures'

// initialize Embla Carousel
const embla = EmblaCarousel(emblaNode, options, [
  WheelGesturesPlugin()
])

React

import { useEmblaCarousel } from 'embla-carousel-react'
import { WheelGesturesPlugin } from 'embla-carousel-wheel-gestures'

const EmblaCarouselComponent = ({ children }) => {
  const [emblaRef, embla] = useEmblaCarousel({ loop: false, skipSnaps: true }, [
    WheelGesturesPlugin(),
  ])

  // ...
}

Examples

Options

wheelDraggingClass

Type: string Default: is-wheel-dragging

Choose a classname that will be applied to the container during a wheel gesture. Pass an empty string to opt-out.

forceWheelAxis

Type: 'x' | 'y' Default: undefined

Force an axis on which to listen for wheel events. Useful if you want to slide horizontally when scrolling vertically or vice versa.

target

Type: Element Default: undefined

Specify the element that should be observed for wheel events.

Global Options

You can also set global options that will be applied to all instances. This allows for overriding the default plugin options with your own:

WheelGesturesPlugin.globalOptions = {
  wheelDraggingClass: 'my-class',
}

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 Jerleke for creating Embla Carousel with its open API 🙏

License

MIT.

8.0.0-rc05

7 months ago

8.0.0-rc04

12 months ago

8.0.0-rc03

12 months ago

3.0.0-rc01

2 years ago

3.0.0

2 years ago

2.2.0

2 years ago

2.1.1

2 years ago

2.0.3

2 years ago

2.1.0

2 years ago

1.2.0

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.1

3 years ago

1.1.1-beta.0

3 years ago

1.1.0

3 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

0.0.9

4 years ago

1.0.0

4 years ago