-
Notifications
You must be signed in to change notification settings - Fork 195
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
Add percentage option for partial visibility #152
base: master
Are you sure you want to change the base?
Conversation
@@ -1,14 +1,12 @@ | |||
React Visibility Sensor | |||
==== | |||
# React Visibility Sensor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These markdown changes came from the prettier commit hook. I noticed that the commit hook wasn't covering the .jsx
test file, so I updated it to include that
… off the top of the screen
Is this ready to be merged in @joshwnj? This'd be really neat feature to have :) |
is this stale? This would be awesome to have!! |
@Maxenboy I haven't heard anything, but my team ended up forking the library, and we plan to swap it out with intersection observers, which have support for percentage thresholds built in. |
Just spent 30 minutes trying to implement this before realising it hasn't been merged yet! I just did this until this gets merged in:
|
Hello! This change introduces a new prop,
minTopPercent
, which allows you to trigger a visibility change when a certain percent of the child component is visible. Our use case is that we have elements with dynamic heights, where we're interested in detecting if they're 50% visible, rather than checking for a fixed pixel value.For example, to check if a component is 80% visible, you could use:
If this is merged, it would close #125
thanks!