fkhadra / react-on-screen

Check if a react component in the viewport
https://fkhadra.github.io/react-on-screen/
MIT License
405 stars 50 forks source link

Allow passing prop to change tag to listen for scroll #51

Open Freysi21 opened 5 years ago

Freysi21 commented 5 years ago

Hi

Love the component been using it a bunch. I just refactored my website to handle parallax scrolling with translateZ and perspective. This scrambled a bunch of stuff for example a fixed header within the body layout. So I needed to move the overflow scroll property from body to a child tag.

Now the visibility component doesn't work since it only listens to window scroll or document scroll.

Freysi21 commented 5 years ago

I started this pull request

https://github.com/fkhadra/react-on-screen/pulls

I change the .gitignore to refrence the repo in my package.json.

Essentially I just passed in the id of the new scrolling element to listen to and search it with getElementById