Hello dev.to folks! This is my first post - woot! Pretty excited to share what I have been learning recently about lazy-loading. Please let me kn...
For further actions, you may consider blocking this person and/or reporting abuse
Hi! Thanks for sharing!
As far as I’ve noticed, the number of entries depends on the number of thresholds you provide.
So, in this case, if we have
threshold: 0.5
, there will be only one entry.I might be wrong. I’ll check as soon as I can.
Hey Andrei! Thanks for reading! Appreciate the time you took to read. I believe the # of entries is the # of selection. Feel free to play with my codepen:
codepen.io/iggredible/pen/axQJwg
On JS, you can see that I
console.log
my entries. Right now I have 10 images. You'll see:If you removed some of the images (say you removed 3, leaving you with only 7 img elements on HTML), you'll see:
This is why I believe # of entries depends on # of elements you selected. The way I interpret it is, each entry is IntersectionObserverEntry object - I see it as properties of each image that are related to intersectionality. I think this is how IntersectionObserver keeps track of when each entry 'intersects' with viewports (or whatever ancestor you chose). As proof, you can see one of them having these attributes:
I digress a little, but hope it helps!!
Thanks for such a detailed and explanatory answer!
It definitely helped, now I have solved my misunderstanding.