Moode Forum

Full Version: Native browser support for lazy loading images
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If all album art would be  loaded at the start of the client, it would uses a huge amount of resources.
To prevent that moOde use a thirdparty jquery library called [url=*   http://www.appelsiini.net/projects/lazyload]lazyload[/url].

For some time a number of browser supportthe native lazy loading attribute, see for browser support https://caniuse.com/#feat=loading-lazy-attr.
It would be great is moOde uses the native lazy loading when present.

When interested I can make a PR for it. Patch is already available here.
interesting.

I don't understand the Browser space well enough to know what if any side effects there would be, and IIRC we have customized the jQuery lazy loader to do a few special things for moOde. I'll have to rack my brain to remember what they are but I know one of them was to specify a particular default background to be used.

But it sounds like we can query the Browser to determine whether it support "native" lazy loading and then fallback to the jQuery model if needed.

What the advantage of using native lazy loading?
Native support from the browser is more efficient and taking advantage of improvements on the browser as opposed to maintaining your own library.
And the good thing is you can have both. 

I have created a PR DEMO:If supported, use native lazy loading of the browser. to demonstrated the native icw fallback to the current loading.