ashthornton / asscroll

Ash's Smooth Scroll 🍑
MIT License
947 stars 27 forks source link

Multiple scroll areas #61

Open grommas opened 3 years ago

grommas commented 3 years ago

Hi @ashthornton

I’m fiddling around with your scroller (again). Is it possible to have multiple scroll areas? It would be nice to have separated and smoothly scrollable areas. My current tests always have some glitches.

Codepen: Multiple scroll areas (test 1: one scroller) Codepen: Multiple scroll areas (test 2: multiple scrollers)

Any advice?

ashthornton commented 3 years ago

This is something I have thought about adding before. It would be nice to have the option to create multiple instances and target multiple elements

But right now as you can see it would involve some really hacky methods in order to get this to work. The main issue is that ASScroll listens to wheel and scroll events on the window rather than the element you're scrolling, so it will scroll all instances at once. In theory this isn't too difficult to implement so I'll make this an enhancement and get round to it at some point!

The scrollbar should also be positioned correctly inside the scrollable element.

grommas commented 3 years ago

Makes sense. So I’ll try to find another solution for now. Nevertheless it would be a great enhancement! Thanks for your reply!