Skip to content

Commit

Permalink
Fix bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjerleke committed Aug 4, 2023
1 parent 5c9d7f3 commit 044aaf1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/embla-carousel/src/components/ScrollTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { EventHandlerType } from './EventHandler'
import { ScrollBodyType } from './ScrollBody'
import { ScrollTargetType, TargetType } from './ScrollTarget'
import { Vector1DType } from './Vector1d'
import { isNumber } from './utils'

export type ScrollToType = {
distance: (n: number, snap: boolean) => void
Expand All @@ -23,6 +24,7 @@ export function ScrollTo(
const distanceDiff = target.distance
const indexDiff = target.index !== indexCurrent.get()

if (!isNumber(distanceDiff)) return
targetVector.add(distanceDiff)

if (distanceDiff) {
Expand Down

0 comments on commit 044aaf1

Please sign in to comment.