Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trigger when it reaches a certain section of the viewport/containment #166

Open
gunn-fd opened this issue Sep 18, 2019 · 1 comment
Open

Comments

@gunn-fd
Copy link

gunn-fd commented Sep 18, 2019

Could be a feature, where you can set a height of an area where the trigger for visible happens instead of being the whole viewport or whole containement element.

@AntonioRedondo
Copy link

Yeah, I also came across with this limitation. It would be very useful if React Visibility Sensor was able to fire some callback given some vertical or horizontal level of the parent child or the whole <body> element. Something like:

<VisibilitySensor
    onScrollPosition={{
        y: 2000, // in pixels
        x: 500, // in pixels
        fromBody: true,
        callback: (direction) => doSomething(direction)
    }} />
  • fromBody is a boolean that if true the whole <body> html element would be considered for the scroll events instead of the parent child.
  • direction could be a string with up and down possible values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants