react-scroll
react-scroll copied to clipboard
How can I get notify when one `Element` is scroll out of viewport?
Per title, I want to do some extra work when the Element is out of viewport. And I don't need Link to display on the screen, so the Link's onSetActive will not help.
There are a few events you could subscripe to.
Begin and End events, you could then detect if your element is outside viewport.
Events.scrollEvent.register('begin', function(to, element) {
console.log('begin', arguments);
});
Events.scrollEvent.register('end', function(to, element) {
console.log('end', arguments);
});
As I tested, this event only trigger when use scroll method of react-scroll not the scroll of browser. If I understand wrongly, please correct me.
What I want to do is notify me when element was scrolled (by mouse or trackpad) out viewport.
Would also like to know. The documentation is vague and the examples not complete.