Stanko / react-plx

React parallax component, powerful and lightweight
https://muffinman.io/react-plx/
MIT License
689 stars 51 forks source link

Support scrolling on non-window element #34

Open Akkuma opened 6 years ago

Akkuma commented 6 years ago

Thanks for making react-plx. I've ran into a semi-serious feature that doesn't yet exist in that all scroll events are expected to come from the window. This makes it impossible to do something like body { overflow: hidden; } and have some child element actually be the one scrolling.

The feature request would be for plx to accept a scroll target, which means implementing it in both plx and scroll manager.

Stanko commented 6 years ago

Hello @Akkuma, It is a tricky one indeed. I had an idea of adding scrollPosition (or just position) prop, and if it is passed it should be used instead of window scroll tracking. It would cover your case (scrolling elements instead of widow) but it would add additional flexibility.

It shouldn't be too hard, but I have a lot of going on atm, so I'm not sure when I'll get to it.

Cheers!

ZakTax commented 6 years ago

+1 on this

josantana commented 4 years ago

Anyone working on this subject?

Got all my animations working with react-plx, but after applying the full layout, I had to move the scroll target to a specific div tag and... damn. :(

Stanko commented 4 years ago

I don't have time to tackle this ATM, but I would gladly accept a PR.