darkroomengineering / lenis

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

ScrollTo not triggering when screen height is below 100vh #378

Closed GustavoGomez092 closed 3 months ago

GustavoGomez092 commented 3 months ago

Describe the bug Whenever using the lenis.scrollTo() method, if the screen height is less than 100vh, the event seems to not get triggered, so callbacks like: onStart or onComplete never get triggered. I would expect the method to execute the callbacks accordingly.

To Reproduce https://codepen.io/gustavogomez092/pen/oNrpMLo?editors=1111

feledori commented 3 months ago

Why should it trigger the callbacks lenis never scrolled anywhere? "scrollTo" never "scrolled to" anything because there is nothing to scroll so I wouldn't expect it to call anything.

clementroche commented 3 months ago

Not sure about what I expect here but I pushed the fix anyway lol. v1.1.11

GustavoGomez092 commented 3 months ago

That is amazing! I specifically stumbled upon the scenario where I needed these events while the router changed views to finish a page transition animation, but since this event got triggered right at the moment the page does not have any content on it, then it wasn't triggered, I understand @feledori point of view and it is certainly valid, but I'm glad you took this into consideration @clementroche