johannschopplich / unlazy

🪧 Universal lazy loading library for placeholder images leveraging native browser APIs

Home Page:https://unlazy.byjohann.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow optional non-native lazy loading with intersection observer

arnoson opened this issue · comments

Describe the feature

First of all, thanks for the great tool!

I want to migrate a website I built with loadeer to unlazy, mainly because of the inbuilt support for thumb-hash. Unfortunately Chrome's native lazy loading is way too eager for my usecase. I Have a website with a lot! of accordions stacked on top of each other, each accordion content is display: none. But nevertheless Chrome loads the images inside the closed accordions, and worse, because the closed accordions don't take up much vertical space Chrome loads nearly all of the hundreds of images on the initial page load.

I guess I have quite a niche setup, but it might be also helpful in other unusual/complicated setups to have the option of using an intersection observer based solution for the lazy loading part. What do you think?

I guess I could also built my own intersection observer and manually load the images with loadImage.

Additional information

  • Would you be willing to help implement this feature?
  • Can you think of other implementations of this feature?

Final checks

Hi there!

Sounds like a great idea. Maybe even tree-shakable with a build-flag and disabled by default to keep it an opt-in approach.

Unfortunately, I neither have the use-case nor the time to implement such feature. PR welcome. 🙂

I'm in parental leave right now, so I won't find time soon. But good to hear that you are interested in the feature! I'll close this issue and might create a PR in the future!