Native Lazy Loading + A Fallback Solution ..in 60 seconds

preview_player
Показать описание
(Codepen code below) Chrome just released native lazy loading, so here's an insanely succinct video that will show you how to get up and running with a fallback solution using 'lazysizes'.

Tutorial dialogue:
"First, we need to enable lazy loading in the chrome flags because this is, well, sort of new..

Intially, we'll load these images without lazy loading, just to show you what the network tab looks like -- you're pointlessly loading all of this content when a user might not scroll down! (WASTE OF BANDWIDTH)

We're going to change the src attribute to a custom attribute, and add loading="lazy" to make this work..

Next, we write a bit of JavaScript to determine if the browser supports native lazy loading. Yay, ours does!

If it does support it, we iterate through our images and add the src attribute.

If there's no support, we can dynamically include a javascript src to a third party lazy loading library like lazysizes as a fallback!

Check it out, it's only loading the first few images. As the user scrolls, it works, yay!

For the fallback, add the lazyload class. Try it out in a non supporting browser like firefox and watch it work!"

This tutorial was based on the great content about native lazy loading found here:

What's up with the 60 second format? I stumbled across another channel in a different niche that provides 60 second tutorials and thought I'd give it a shot. Thoughts?

Sign up to my UI design course coming out very shortly!

- - - - - - - - - - - - - - - - - - - - - -

Subscribe for NEW VIDEOS!

^-Chat with me and others

- - - - - - - - - - - - - - - - - - - - - -

Come to my discord server or add me on social media and say Hi!
Рекомендации по теме
Комментарии
Автор

This is perfect! Just learnt something new in 60 sec that would have otherwise taken couple of hours 😁

somalipirate
Автор

this format might be a new interesting way of making videos but I gotta admit i've always loved to sit and watch a video step by step made by you.
I'd like to say also that watching the process of picking up the values for margins/padding ecc and all the measures during the css making,
instead of copying from a work made before the video, would be great!
To see exactly all the work around a project and the final result like if it was a live stream :)

JaysWorld
Автор

I love to see a series of videos like that name them "Under 60 sec"

alinawaz
Автор

I really like this format of videos! Straight to the point and concise! However, I'd like to see your old style as well, I mean don't completely replace the old style with this one.

amirhosseinahmadi
Автор

The most informative 60 seconds of life !

aciraxeroteam
Автор

I love this new format so much, quick fast and straight to the point without the tedious part

FishyLipz
Автор

Wow, amazing. This format of explaining a topic fast and to the point is just superb. Even faster than me thinking and typing my comment.

noorahmed
Автор

YES. THIS IS LIKE LAZY TUTORIAL'S FORMAT AND IVE BEEN WANTING THESE FOR MONTHS

senecamanu
Автор

this is fkin amazing! do more vids like this!

alenv
Автор

Oh my god 😍 Love this format, quick‘n‘dirty (but crystallclear message ). Please keep it up for those little helpful things. Love it! ❤️❤️❤️

teppichkuchen
Автор

I really appreciate these quick videos. It lets us learn very specific new skill without feelling overwhelmed by too much unnecessary detail's.
Plus, we can learn this on comute :)

ruipinto
Автор

I love this new series please continue this...

spacetimekiddo
Автор

Wow... MAny thanks for this. WE need more videos like this.

michaelimara
Автор

Perfect timing. Just when I was looking at a fallback to lazy loading. Cheers!

webjaved
Автор

This is awesome! 60 seconds solutions FTW!

anirudhkhanna
Автор

I break my procrastination. Yay!
Thanks to your speedy video!!

nac
Автор

Bro you reading my mind, i was just researching this last night! Thanks for the video!

diceygaming
Автор

Great format to explain stuff, please give us more

alubto
Автор

This will definitely help me with my dad's portfolio website. I'm not currently lazy loading images and the site takes a few seconds to load a new page. This should hopefully speed things up tremendously!

ThunderBow
Автор

Just loved this format! Quick and straight to the point 👌

renji_yo