Closed DanielJWood closed 6 months ago
When images are written to the page, there are image tags and data-src
attributes, but the src
isn't filled in.
How I'm reading this code:
When a slide with an image is coming up in the queue (the neighbors
— either the current slide (0), the previous slide (-1), or in the next 2), it'll move the data-src
into src
and trigger the image to load.
I'm not sure about the poster
ones — I'm assuming that has to do with poster images on video, though I thought those were baked into the video tags, not separate image attributes. (I could be wrong on that though.) And for ice melt, I think video lazy-loading was handled elsewhere.
Here's some discussion of this sort of thing: https://github.com/maplibre/maplibre-gl-js/issues/116 https://github.com/mapbox/mapbox-gl-js/pull/11328
I'm wondering if we can lazy-load slides, if we can ever anticipate ahead of time what location/layers the user will get next in terms of PMTiles. Might be impossible based on structure. not sure.
But we do it for images...I can't quite parse what's happening here in the code, but here it is: