d4nyll / smartscroll

jQuery plugin for scrolljacking and auto-hashing

Home Page:https://d4nyll.github.io/smartscroll/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Horizontal scrolling

YPCrumble opened this issue · 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!

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.