smartscroll icon indicating copy to clipboard operation
smartscroll copied to clipboard

Horizontal scrolling

Open YPCrumble opened this issue 7 years ago • 1 comments

Hi - thanks for building this library!

I'm looking for a solution that allows me to implement scrolljacking on mobile only for a horizontal list. Something like this example but that scrolls each card one by one, snapping each card into the featured position each time the user scrolls.

Is this something that would be interesting as a new feature for this library? Any suggestions on how I could begin adapting it?

Thanks!

YPCrumble avatar Jul 05 '18 18:07 YPCrumble

Thanks for the question!

It's something that I've considered yes. In fact, it was on the README.md until 20 December 2017 (see this commit that removed it)

To implement horizontal scroll won't actually be that hard, just extremely tedius. You'd have to change every "Y" action to "X" and vice versa. For example, instead of getWindowTop, you have to do getWindowLeft and use pageXOffset instead of pageYOffset. Repeat this for every option and you'll have horizontal scrolling.

For me to add this feature to the library, I'd have to add a flag that switches between the "Y" and "X" options, which can get quite messy. So I won't have time to work on it any time soon, unfortunately.

d4nyll avatar Jul 07 '18 18:07 d4nyll