Skip to content
Discussion options

You must be logged in to vote

@richsoni-spotify I see. You should be able to do something along these lines:

const settlePixelThreshold = 10

function fireCustomSettle(emblaApi) {
  const { dragHandler, location, target } = emblaApi.internalEngine()
  if (dragHandler.pointerDown()) return // Bail if user is dragging

  const displacement = target.get() - location.get()
  if (Math.abs(displacement) < settlePixelThreshold) {
    // do your thing here
  }
}

emblaApi.on('scroll', fireCustomSettle)

However, please note that this will fire multiple times as long as displacement is less than settlePixelThreshold. You might want to add some sort of check to prevent that.

Best,
David

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@davidjerleke
Comment options

@richsoni-spotify
Comment options

@richsoni-spotify
Comment options

@davidjerleke
Comment options

Answer selected by davidjerleke
@richsoni-spotify
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
resolved This issue is resolved question Question about how to achieve something
3 participants