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
Cant seem to have this polyfill work in screen size <768px #300
Comments
Can you provide a demo showing the problem? In general the polyfill should work for any screen size. I suspect in your case there may be a media query doing something you're not accounting for (or something like that). |
I've just encountered a case where on iOS Safari & Chrome In my case I have almost full width cards that are horizontally scrollable using the newer CSS scroll-snap API and are observed with an intersection threshold of 0.53 so there's only 1 card intersecting at all times. I wonder if this issue is related so if still relevant, @tifidy can you check if using |
@ybentz a repo would be helpful.
Can you add some more detail here? What do you mean by "worked by had a bug"? |
@philipwalton I can try and get a repro for it.
I described the bug in detail on the next paragraph but I'll try to simplify. |
Also, if the behavior the same with and without the polyfill? |
Even with the intersection threshold set to < 1? That's why I mentioned setting the threshold to 0.53.
I think it's only with the polyfill. |
Yep, here's how it's defined in the spec: https://w3c.github.io/IntersectionObserver/#dom-intersectionobserverentry-isintersecting
Intersection ratio is definitely the preferred way to check. The |
Huh, that's good to know! And it's also really interesting then. A few things to note:
|
Hmmm, yeah, MDN is wrong here. As for your iOS issue, it's hard to say without seeing a repro. It's possible that iOS has a bug with one of the APIs the polyfill uses (e.g. Are you still seeing the issue on 12.1+? Safari and iOS have a native implementation of IntersectionObserver now, so if the issue is gone I'm happy to assume it was just a Safari bug that's been fixed. |
I don't have access to a physical device atm but I tried on the mac's simulator, on iOS 12.2 everything works just like on any other browser (matches the behavior described on MDN) but on iOS 11.4 I still see the bug I described, using Might be unrelated to the bug but I'm still pretty confused about |
OK, some 3 years later I think we're good to close here. |
I am using this polyfil to lazyload images that works marvelously but somehow when I resize window down to less than 768px. Polyfil observes images but does not throw isIntersecting:true. It works fine when browser is actually supporting IntersectionObserver. Any help appriciated .
Thank you!
The text was updated successfully, but these errors were encountered: