Open in app
Jason Knight
136 Followers
About

Sign in

136 Followers
About
Open in app
Jason Knight

Jason Knight

·Dec 20, 2020

Why aren't you using loading="lazy" in the markup with hooking the load event on the images? If you set the blurry image as the background-image and the full image as the src, you could probably ditch "unsplash", and around two thirds your scripting too.

See my own lazy loading article:

https://levelup.gitconnected.com/enhancing-html-5-lazy-loading-with-css-and-minimal-javascript-afe274088f0b

Lazy Loading Images with Vanilla JavaScript
88
2

Mehdi Aoussiad

More from Jason Knight

More From Medium

CSS Character Styling Using Background-Clip

Jason Knight in Level Up Coding

HTTP 2 Push: Fact? Fiction? Placebo?

Jason Knight in Level Up Coding

The “Live DOM” Is Not “Slow”, “Bad”, Or “Wrong”. Web Developers Are.

Jason Knight in Level Up Coding

React And Its Ilk Are NOT “Accessible”

Jason Knight in Level Up Coding

JavaScript Table Sorting (Part 2 of 2) — Enhancement!

Jason Knight in Level Up Coding

Stop Making Incomplete Inaccessible Forms!

Jason Knight in Level Up Coding

Overcoming CSS Not Calculating Auto-Height For Transitions

Jason Knight in Level Up Coding

JavaScript Table Sorting (Part 1 of 2) — Start Out Simple

Jason Knight in Level Up Coding

About

Help

Legal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store