jsonkao / react-scrollama

Simple scrollytelling with the IntersectionObserver in React.
https://jsonkao.github.io/react-scrollama
MIT License
388 stars 30 forks source link

Default scroll direction Down #105

Closed tuckergordon closed 1 month ago

tuckergordon commented 1 month ago

There is an edge case where if your step element is visible when scrollTop is 0, the scroll direction will be up. I.e. when you first load your page, the first scroll direction you'll see in onStepEnter will be up.

While admittedly an edge case, I think we should switch the logic so that the default scroll direction is down

fschwander commented 1 month ago

Hey @tuckergordon, I totally agree with you. I fixed that in my implementation of react-scrollama with an ugly hack. But to fix it permanently, like you did, would be much better. So, therefore, a thumbs up from my side. Or as we say it in ma place of work: LGTM (looks good to me). Check out lgtm.ch ;)

https://lgtm.ch/i/oHcDMwv4.gif

jsonkao commented 1 month ago

Seems like a great fix. Thanks @tuckergordon @fschwander