ryanhefner / react-scroll-trigger

📜 React component that monitors scroll events to trigger callbacks when it enters, exits and progresses through the viewport. All callback include the progress and velocity of the scrolling, in the event you want to manipulate stuff based on those values.
https://www.pkgstats.com/pkg:react-scroll-trigger
MIT License
129 stars 17 forks source link

Use in scrollable div, not just on body scroll #122

Closed oze4 closed 4 years ago

oze4 commented 5 years ago

I am unsure if this PR conflicts with the intended use of this component, specifically the containerRef property, but this modification solved a use case I had. It also solves this open issue.

You can now use a container which will trigger all events for nested ScrollTrigger components.

I have built an detailed live demo, which you can view here, as well as the demo code, which is at this repo.

ryanhefner commented 4 years ago

Hey @oze4,

Thanks for submitting this, and apologies on the delayed response. Do you think you could update the formatting in the src/index.js page to match the existing 2 space tab format? One, easier to see what changed, but also for consistency.

Thanks! Ryan

RickMeasham commented 4 years ago

@ryanhefner This got closed by @oze4 and moved to done by the bot .. but it doesn't look like it got merged. Has the underlying issue been fixed elsewhere?

ryanhefner commented 4 years ago

@RickMeasham No, don’t think so. I would have been happy to merge in Matt’s updates, but his formatting change made the whole file a diff, opposed to just the changes he made. I might have some time this weekend to review the changes he made and look at maybe porting some of those to get this to work within a scrollable container.

I will close #66 once that work is done.

RickMeasham commented 4 years ago

Thanks mate