Is rootMargin working?
See original GitHub issueIn the recipe for lazy loading images here https://github.com/thebuilder/react-intersection-observer/blob/master/docs/Recipes.md#lazy-image-load I haven’t been able to observe any effect related to rootMargin
This is, images were loading always when barely seen, not before or after
How is this supposed to work?
*In the link example in https://codesandbox.io/embed/lazy-image-load-mjsgc one has to "false"fy the native image loading browser capabilities to test this - in both files (and remove the loading prop)
const supportsLazyLoading = false;
And the margin
has also to be corrected to rootMargin
(I assume)
EDIT: I can see that it is working in other examples where I am triggering animations, but with the one of images It seems to be ignored (?)
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
IntersectionObserver.rootMargin - Web APIs | MDN
The IntersectionObserver interface's read-only rootMargin property is a string with syntax similar to that of the CSS margin property.
Read more >Intersection Observer rootMargin not working as expected on ...
Result: Image only loads when intersecting at viewport , which rootMargin seems to not be working on horizontal level. Here is an example:...
Read more >IntersectionObserver.rootMargin - Web APIs
See The root element and root margin in Intersection Observer API for a more in-depth look at the root margin and how it...
Read more >An Explanation of How the Intersection Observer Watches
The rootMargin is a string of values describing what can be called the margin of the root element, which affects the resulting bounding...
Read more >JavaScript Intersection Observer Ultimate Guide
Now let's break apart how this all works. ... The next useful option you can pass to an Intersection Observer is rootMargin ....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@thebuilder I went over how I assigned
root
and noticed a mistake. Lesson learned, don’t code (or raise issues) while tired. Thanks for the quick reply and handyuseInView
hook, works as expected now 😌root
?<iframe>
?Can you share the an example on Codesandbox?