darkroomengineering / lenis

How smooth scroll should be
https://lenis.darkroom.engineering
MIT License
7.33k stars 316 forks source link

May I ask if it is possible to add an event for scrollEnd in the future? #313

Closed hengshanMWC closed 3 months ago

hengshanMWC commented 3 months ago

Describe the bug May I ask if it is possible to add an event for scrollEnd in the future? I am currently using setTimeout to make an inaccurate judgment

image
clementroche commented 3 months ago

When should it be dispatched ? Can you show an example where it's useful ?

You alread have acess to onComplete callback

lenis.scrollTo(target, { onComplete: () => {
  console.log('scrollTo completed')
}})
hengshanMWC commented 3 months ago

When should it be dispatched ? Can you show an example where it's useful ?

You alread have acess to onComplete callback

lenis.scrollTo(target, { onComplete: () => {
  console.log('scrollTo completed')
}})

Background: There is an object that triggers animation when the mouse moves in or scrolls. I hope the scrolling animation has a higher priority than the mouse animation, and to abort the mouse animation during scrolling

clementroche commented 3 months ago

i don't understand your issue, can you provide a reproduction link ?

hengshanMWC commented 1 month ago

i don't understand your issue, can you provide a reproduction link ?

Hello, I solved whether it was scrolling by checking the lenis.velocity