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

Use it for single query #21

Open
slavafomin opened this issue Jul 25, 2018 · 3 comments
Open

Use it for single query #21

slavafomin opened this issue Jul 25, 2018 · 3 comments

Comments

@slavafomin
Copy link

slavafomin commented Jul 25, 2018

Hello!

Thank you for your hard work, this library looks very professional and feature-rich.

However, I sometimes need to check if specified DOM element is partially visible in the viewport. Is there a way to perform a single synchronous query like this:

true === isPartiallyVisible(element, 0.2) // 0.2 means 20%?

Thanks!

@kettanaito
Copy link
Owner

Hello, @slavafomin.
I am sorry for getting back to you in half a year.

That's a good idea. Overall, I feel the API of this library should be improved, and expose some useful utils like you've mentioned as well. I will try to think about it when I have free time.

@slavafomin
Copy link
Author

@kettanaito Thanks! Let's keep in touch.

@kettanaito
Copy link
Owner

kettanaito commented Dec 14, 2018

I will dedicate some time to improving the current API.
Please, if you have any idea on any section of the API, let me know.

Regarding your inquiry, I would expose something like:

import { takeSnapshot } from 'sentinel-dom'

takeSnapshot(document.getElementById('box'), { thresholdY: 0.5 })
// true

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