-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
inViewport returns true if element is hidden #19
Comments
Got the same issue, and with js cannot get img object style.display = ""
so the workaround:
and also:
or you may try to add in original lib:
but I didn't tested possible consequences, only I tested in vertical scroll |
To be safe I think
for use like Opinions? |
@ryanve My case was lazyloading using two libs: the one of yours: https://github.com/ryanve/verge I could have used https://github.com/vvo/lazyload but it doesn't provide fallback, if the image is not found or broken, and thus in Firefox the image box dissapears, it gets no height, and I needed that height so that data image placeholder should be visible. So I did my own implementation, where having a visibility check was meaningful, because I had hidden images that should show on mobile only. So when testing on desktop, the display none images got loaded because verge says they are in the viewport. So I hardcoded But I'd be happy to have two checks separate property |
If a element is hidden via
display: none
verge.inViewport
returns always true.Can you add a test if a element is visible or not?
The text was updated successfully, but these errors were encountered: