Skip to content

Commit

Permalink
Bug fix for #644.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjerleke committed Dec 22, 2023
1 parent ded98fe commit 228fef4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/embla-carousel-autoplay/src/components/Autoplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ function Autoplay(userOptions: AutoplayOptionsType = {}): AutoplayType {
const emblaRoot = emblaApi.rootNode()
const root = (options.rootNode && options.rootNode(emblaRoot)) || emblaRoot

emblaApi.on('pointerDown', clearTimer)
if (!options.stopOnInteraction) emblaApi.on('pointerUp', startTimer)

if (options.stopOnMouseEnter) {
eventStore.add(root, 'mouseenter', clearTimer)

Expand All @@ -68,6 +65,14 @@ function Autoplay(userOptions: AutoplayOptionsType = {}): AutoplayType {
}
}

if (!options.stopOnMouseEnter) {
emblaApi.on('pointerDown', clearTimer)

if (!options.stopOnInteraction) {
emblaApi.on('pointerUp', startTimer)
}
}

if (options.stopOnFocusIn) {
eventStore.add(root, 'focusin', clearTimer)

Expand Down

0 comments on commit 228fef4

Please sign in to comment.