How To Lazy Load Your Images With Just One Line Of Javascript

To edit in Wordpress, edit /htdocs/index.php

1 Like

Eh, just saw this post…
It is very easy to lazy-load images in pure html. You just add an extra attribute loading=“lazy” to your image element.
There is a nice description here https://www.w3schools.com/tags/att_img_loading.asp

It’s always smarter to keep your code as simple as possible…

1 Like

Here is some better documentation.

In full agreement!

2 Likes

Its not supported in safari

I just use the loading=“lazy” attribute on a regular img.

1 Like

according to w3schools its not supported on safari tho

sucks to be safari then :rofl:

but seriously thanks for this, i didnt know about the loading attribute

1 Like