Lazy loading is too easy now

The first 1000 people who click the link will get 2 free months of Skillshare Premium: skl.sh/kevinpowell0820
Lazy loading can be handled by the browser now, rather than having to write our own scripts for it or relying on a 3rd party. This is awesome because, first of all, it's incredibly easy, and also because the browser will look at things like connection speeds and the user's device to decide exactly how to implement it, all without us having to worry about it. There really is no excuse not to take advantage of and get a nice performance boost for your sites.
/// Links
My video using Intersection Observers: • How to lazy load images
Chrome developers page - web.dev/native-lazy-loading/
Smashing Magazine - Setting Width and Height are important again: www.smashingmagazine.com/2020...
/// Timestamps
00:00 - Intro
02:45 - What is lazy loading
03:27 - simulating slower devices
05:38 - adding lazy loading
08:58 - preventing jumping content
13:28 - advantages of native browser lazy loading
14:54 - lazy loading with the picture element
This video was sponsored by Skillshare.
#html #lazyload
--
Come hang out with other dev's in my Discord Community
💬 / discord
---
Keep up to date with everything I'm up to
✉ www.kevinpowell.co/newsletter
---
Help support my channel
👨‍🎓 Get a course: www.kevinpowell.co/courses
👕 Buy a shirt: teespring.com/stores/making-t...
💖 Support me on Patreon: / kevinpowell
---
My editor: VS Code - code.visualstudio.com/
---
I'm on some other places on the internet too!
If you'd like a behind the scenes and previews of what's coming up on my KZread channel, make sure to follow me on Instagram and Twitter.
Instagram: / kevinpowell.co
Twitter: / kevinjpowell
Codepen: codepen.io/kevinpowell/
Github: github.com/kevin-powell
---
And whatever you do, don't forget to keep on making your corner of the internet just a little bit more awesome!

Пікірлер: 243

  • @KevinPowell
    @KevinPowell3 жыл бұрын

    The first 1000 people who click the link will get 2 free months of Skillshare Premium: skl.sh/kevinpowell0820

  • @SALMANKHAN-zz4gi

    @SALMANKHAN-zz4gi

    3 жыл бұрын

    thank you kevin ! i'll be most productive for the next 2 months now

  • @MrAndi1281

    @MrAndi1281

    3 жыл бұрын

    Hi @Kevin Powell would it make sense to use this together with web.dev/content-visibility/?

  • @KevinPowell

    @KevinPowell

    3 жыл бұрын

    @@MrAndi1281 the only issue with content-visibility is the lack of support outside of Chrome. Wouldn't hurt though!

  • @MrAndi1281

    @MrAndi1281

    3 жыл бұрын

    @@KevinPowell i know, support is lacking a lot but the sooner people know about it, the better right?

  • @Vaeshkar

    @Vaeshkar

    3 жыл бұрын

    Damn 33,000 clicks to late.

  • @bobdinitto
    @bobdinitto2 жыл бұрын

    I'm really glad you mentioned that developers generally have more powerful devices than average users and should account for that in design and testing, as I think this is often overlooked.

  • @emmaaberg3566
    @emmaaberg35662 жыл бұрын

    Conclusin: Add loading="lazy" to all and that users need to scroll down to see. Add a fixed width & height to remove any problems. This will speed up your website.

  • @CarAudioInc
    @CarAudioInc3 жыл бұрын

    I have page on my website with thumbnails, modals that have a slide show of images in them. It's a pretty hefty page to load all at once. I did lazy loading to the slide show pictures. What a difference! Thanks man, love learning little tips like this.

  • @BlackxesWasTaken
    @BlackxesWasTaken7 ай бұрын

    You are a hero Kevin. I was yesterday JUST about to start learning how codesplitting in vite and lazy loading works because of my project getting bigger and more complex.. I stopped yesterday and pushed it to today since I was tired already and boom.. KZread suggests me this work of art.. thank you!

  • @IconicProps
    @IconicProps3 жыл бұрын

    It is a nice format that you explain what you want to talk about, before putting in a intro animation no one really wants to sit through. Not to mention greate information. As a developer its nice to listen along to things I think I already know, and then out of nowhere learn something new.

  • @joerho
    @joerho3 жыл бұрын

    The developer tool throttling tip saved me future headaches... my website was so slow on mobile devices. Thank you so much for that tip.

  • @JohnSmith-rn3vl
    @JohnSmith-rn3vl3 жыл бұрын

    I used the intersection observer technique based on your previous video (customised a bit for our use) and doubled our page speed in some pages. Great for google ranking. Thanks.

  • @KevinPowell

    @KevinPowell

    3 жыл бұрын

    That's awesome!

  • @iamtharunraj
    @iamtharunrajАй бұрын

    Wow, thank you for this video, Kevin. I'm surprised how easy it is to implement but I didn't know about it. This video has helped me so much!

  • @ThomasIkemann
    @ThomasIkemann3 жыл бұрын

    Just KZread'd for lazy loading and thought I need a degree to implement it. Never considered it would be THAT easy! Thank you alot!!

  • @samkeen
    @samkeen3 жыл бұрын

    Wow, love the different loading distance based on connection speed!

  • @sethrandall9263
    @sethrandall92632 жыл бұрын

    Awesome video! This is exactly what I was looking for when getting started with native lazy-loading.

  • @daveskye
    @daveskye3 жыл бұрын

    Great tip! - Will be using this one, nothing to lose!

  • @TrixyJ
    @TrixyJ3 жыл бұрын

    Amazing tip. Especially on lazing loading for big images.

  • @chiky22lp
    @chiky22lp10 ай бұрын

    Hey! Thanks for the 2 months of Skillshare, still working. Great tutorial 🙌

  • @adrianfiedler3520
    @adrianfiedler35203 жыл бұрын

    That moment you use intersection observers for lazy loading and then Kevin tells you there is a "loading=lazy" attribute on images ...

  • @ne9835

    @ne9835

    3 жыл бұрын

    Lolll!!! 🤣

  • @Rhidayah

    @Rhidayah

    3 жыл бұрын

    observers js utility: "I'll handle that" loading=lazy attribute: "i'm about to end this man's whole career"

  • @J90JAM

    @J90JAM

    3 жыл бұрын

    @@Rhidayah Intersection Observer is more versatile still.

  • @pjgeeroms

    @pjgeeroms

    3 жыл бұрын

    Loading=lazy is not supported in all browsers or some outdated browsers so a fallback like lazysizes still seems like a good idea to me.

  • @thulo5204

    @thulo5204

    3 жыл бұрын

    literally burst into tears

  • @aram5642
    @aram56423 жыл бұрын

    Yeah, you just made me realize I should refresh myself on the picture and figure elements...

  • @joakimjohansson7729
    @joakimjohansson77293 жыл бұрын

    Just found your channel, so much great content, thank you!

  • @stewartw.9151
    @stewartw.91513 жыл бұрын

    A great tip which I did not know about - thank you Kevin!

  • @nielslytzdk
    @nielslytzdk3 жыл бұрын

    Very nice, much easier than doing intersection observers. Thanks Kevin :)

  • @bF93712
    @bF937123 жыл бұрын

    Great to see Timestamps! Nice tutorial!

  • @shaderone07
    @shaderone073 жыл бұрын

    This is really an amazing tip...Thank you very much kevin

  • @justinoneill2837
    @justinoneill28373 жыл бұрын

    _loading="lazy"_ _mind="💥"_

  • @freekieh9235

    @freekieh9235

    3 жыл бұрын

    Hotel=“trivago”

  • @justinoneill2837

    @justinoneill2837

    3 жыл бұрын

    @@freekieh9235 I know... I look like the trivago guy

  • @freekieh9235

    @freekieh9235

    3 жыл бұрын

    @@justinoneill2837 lmao

  • @vildanmorina2499

    @vildanmorina2499

    3 жыл бұрын

    kzread.info/dron/QW4cq2UBJKb4GWhzposDTg.html Subscrie the Channel please. I am going to upload Video Content about Web Development

  • @IanZamojc
    @IanZamojc3 жыл бұрын

    You can middle mouse drag down through multiple lines to create a vertical multi-cursor as well.

  • @sammygitongar9262
    @sammygitongar926211 ай бұрын

    Great job, Kevin.

  • @bluecafe509
    @bluecafe5093 жыл бұрын

    You sir are a gentleman and a scholar.

  • @xcoda
    @xcoda3 жыл бұрын

    A great tip Kevin. I owe you this knowledge

  • @xcoda

    @xcoda

    3 жыл бұрын

    I've been studying front end for long time now. I've always felt unready to start making some income from the skills and when I do want to start, I don't know where to start from. How to get myself out there. Any advise please. I really need it

  • @castlemoyle
    @castlemoyle3 жыл бұрын

    I use a lot of your lazy loading using JS for a site I support that has an enormous number of scanned advertisements (from the teens-40s). Either the images are small to load quickly or they are large so you can actually read them. Your earlier lazy loading makes the pages load way faster. Now I'll have to play with this and see if it's as easy as you say it is. (Grin)

  • @namakudamono
    @namakudamono3 жыл бұрын

    Thanks for the video Kevin. I’m using the lazysizes JS for this purpose, however it’s great to see similar functionality being implemented in the browser natively. You touched on it a little here, but may I ask if you would consider doing a video on CLS in the future, please? This will be a Google Pagespeed metric in the near future, so I’m trying to work on my employer’s website to reduce layout shift as much as possible. Any tips would be greatly appreciated. Keep up the great work!

  • @MrJahchap
    @MrJahchap2 жыл бұрын

    Great one Kevin as always. Please how do you do same for background images?

  • @diblui
    @diblui3 жыл бұрын

    You're better than netflix to me ❤️

  • @mario7501
    @mario75012 жыл бұрын

    This is amazing. Had no clue this feature existed

  • @vikasnigam9646
    @vikasnigam96463 жыл бұрын

    Very well excellently explained

  • @s.a6668
    @s.a66683 жыл бұрын

    Another great tip!

  • @davidaragon7741
    @davidaragon77413 жыл бұрын

    I'm so glad I watched this video else I'd still be using some JS for this, heres your Like good man!

  • @mohamadhelaly4979
    @mohamadhelaly49793 жыл бұрын

    Thanx alot as always you are awesome 👌

  • @ryansandigan7184
    @ryansandigan71843 жыл бұрын

    Oh wow, native lazy loading but I am more amazed at your css img { max-width: 100%; height: auto; } That's what I need! Because I am doing lazy loading in a hard way >_

  • @romuloalves9349
    @romuloalves93493 жыл бұрын

    Ótimo vídeo parabéns ✌.

  • @codearabawy
    @codearabawy2 жыл бұрын

    Loved it!

  • @psinke
    @psinke3 жыл бұрын

    Nice. Hadn't seen this feature yet. Thanks. Will the lazy loading also work in combination with the 'srcset' attribute of the img tag for multiple image sizes?

  • @_timestamp
    @_timestamp2 жыл бұрын

    Thank you!

  • @Framework-kg6gt
    @Framework-kg6gt3 жыл бұрын

    Thanks m8. Big help.

  • @Holy_Frijole
    @Holy_Frijole2 жыл бұрын

    Question. I want to redo my portfolio site and have lots of images in a lazy loading grid/masonry. [6:30] in this video you demonstrated that a wall of text stops more lazy loading batches of images. Sooooo, what's the best practice to load batches of no more than X number of images at a time? Will I need JS?

  • @TylerThomas
    @TylerThomas Жыл бұрын

    What size do you recommend a standard blog image be in megabytes? 3MB sounded reasonable but I guess not! Love your content, thank you for sharing your knowledge.

  • @wats-on-Internet
    @wats-on-Internet2 жыл бұрын

    Hi Kevin Thanks I think I have watched almost all your videos and am doing the 21 days Great work!! I am looking at a website for photos. I have in effect 4 cols on a big screen and this reduces to 1 col on smaller screens. You say in the video “don’t us lazy load where the photos are above the fold”. So I have 12 photos above the fold on a big screen and only 1 on a small screen, where lazyload is likely to even more important. How do I deal with this for the 4 - 11 photos that need lazy load dependent on screen size? As this comes in the HTMl not in the CSS. Will lazyload on images that are sometimes on the screen at load cause a problem, or did you say that just because it is not needed?

  • @unleashthedog
    @unleashthedog3 жыл бұрын

    My problems with lazy loading are definitely the jumping issue described, but also the content end up not being searchable with the browser find function. And I've often seen this used in page displaying lists [that you naturally want to search, and being text wouldn't be heavy to load]

  • @KevinPowell

    @KevinPowell

    3 жыл бұрын

    This is only for images and s, so I don't see how it would effect a list? For that type of issue, it's where JS is at play and hiding content.

  • @robertlinder8464

    @robertlinder8464

    3 жыл бұрын

    There will be no layout shift if you specify the (intrinsic) width and height of the images, just as he did in the video.

  • @unleashthedog

    @unleashthedog

    3 жыл бұрын

    @@KevinPowell I'm not sure how it has been implemented, I assumed JS like you say. But if you apply this method to a for example, wouldn't that create the problem I mentioned?

  • @birdofhermes6152
    @birdofhermes61523 жыл бұрын

    Thank you a lot.

  • @Smackindaface
    @Smackindaface3 жыл бұрын

    Hey Kevin, could you do a video on google pagespeed insights? Specifically Largest Contentful Paint

  • @MroMroMarc
    @MroMroMarc3 жыл бұрын

    You're the best!

  • @joulesgarcia400
    @joulesgarcia4003 жыл бұрын

    Thank you for this maaaaaaaaaaaaaaaaaan!!!!!!

  • @andrewcourtney3480
    @andrewcourtney34803 жыл бұрын

    Great video Kevin! Could you maybe do a roundup of lazy loading image content - whether it's block-level images or background images? I've tried various JS plugins which have been hit and miss for this type of thing.

  • @equintar
    @equintar3 жыл бұрын

    Thank you for this trick. I want to know your opinion about a responsive carousel and this lazy loading feature. Could it replace third party JS coding?

  • @GiancarloCarccamo
    @GiancarloCarccamo2 жыл бұрын

    great video

  • @michaelunderwood433
    @michaelunderwood4333 жыл бұрын

    Great video, but I compared js lazyloading with this native method and would have got an advantage only if it were possible to alter (and reduce) the vertical distance between the viewport and image where the native load image is triggered.

  • @mattwood8659
    @mattwood86593 жыл бұрын

    okay seems easy. But I have a question/concern. What about dynamic websites with the whole below and above the fold thing. Such as an e commerce shop and there will be products listed above the fold but also the fold is not set as it depends on whatever browser, so you don't really have control over which ones will be above or below the fold, it's either one or the other as you're using php to code only one product-card that then gets reused and repeated for each product. So you can't really have control over which will have lazy or not. If that makes sense. Also with browser support, how are supported it the aspect ratio thing, because if that isn't supported fully yet then do you end up with gaps on responsive sites?

  • @3asel455
    @3asel4552 жыл бұрын

    Gotta love having a 6mb download and a .3mb upload :D

  • @CastleShield
    @CastleShield2 жыл бұрын

    thanks

  • @NimbleWands
    @NimbleWands2 жыл бұрын

    Thanks!

  • @KevinPowell

    @KevinPowell

    2 жыл бұрын

    So sorry for the late reply on this one, YT doesn't do anything to notify us of the super thanks... but thank you so much!

  • @FaisalMalik-fu5vn
    @FaisalMalik-fu5vn2 жыл бұрын

    Hey, Kevin great video! Can you please guide us on how to disable WordPress native lazy loading for the hero/featured image or largest contentful paint?

  • @TheLucidway
    @TheLucidway3 жыл бұрын

    Mr. Kevin, really good breakdown. I just have a question about setting height and width attributes on the img tags. We can set each attribute only once, but what if the user has a device or desktop that has a different size than the values that were set? Wouldn't that still create a content shift because of the different dimensions?

  • @tomcoop9750

    @tomcoop9750

    2 жыл бұрын

    I think when the image’s max-width is 100% and the height is auto, the computer can make this calculation and prevent the elements from shifting.

  • @mattvega
    @mattvega3 жыл бұрын

    A UX consideration: A placeholder background would be great

  • @v0xl

    @v0xl

    3 жыл бұрын

    with moving line (pseudo-element with box-shadow)

  • @jamesc86808

    @jamesc86808

    3 жыл бұрын

    blurred, low res version of the image is usually a good solution

  • @welikerosafloyd

    @welikerosafloyd

    3 жыл бұрын

    Any example of these? I think I don't understand

  • @jamesc86808

    @jamesc86808

    3 жыл бұрын

    @@welikerosafloyd Yeah -- On youtube, as you are scrolling down, before they load the video they load a simple placeholder widget that looks like the outline of the video/text before loading the videos. Tells user where to expect content and helps with preventing things from jumping around by "reserving" the space with the placeholder that has the same dimensions as the content.

  • @welikerosafloyd

    @welikerosafloyd

    3 жыл бұрын

    @@jamesc86808 Great example man, I see what you're saying. Thank you!

  • @albertoesquivias6073
    @albertoesquivias60733 жыл бұрын

    great vid, thanks! i dont css much but i like to keep up to date. sry if dumb Q incoming... when you placed those height and width attr on the img elements themselves, just curious where those numbers came from? would using auto here be an option? might have to place those imgs in a container with what the combined height and width for auto to work?

  • @KevinPowell

    @KevinPowell

    3 жыл бұрын

    I'm using the actual pixel dimensions of the image 😊

  • @ourworldbeauty
    @ourworldbeauty Жыл бұрын

    So, can loading="lazy" be used for other elements like ?

  • @rawhasan1180
    @rawhasan11803 жыл бұрын

    Thanks for the nice tips about native lazy loading. Did not know lazy loading is that easy! I am going to look at your other videos about responsive images. Two recommendations for the channel: - Can you please put the camera further away from your face when you are talking in full-screen? It feels too close and annoying. - Also can you please speak a little slowly, specially in the intro section of the video when you are trying to grab attention? I am fluent in English, but still it sounds almost gibberish! Please take these as a constructive feedback to improve the channel. All the best for the channel!

  • @nicolasmayer618
    @nicolasmayer6183 жыл бұрын

    It would be great, if there would be a head request to receive the width and height for an image and set it to the img. Or is there a possibility?

  • @MikeKing710
    @MikeKing7102 жыл бұрын

    Hi Kevin! Nice video. I've faced with one "bug" with my background image which takes whole height of website. When I scrolling up or down this image jitter with black lines on the top and bottom of viewport. I thought the problem is related with loading and I need to implement with lazy loading but it doesn't solve my problem. What is it can be? Thx

  • @toma1610
    @toma16103 жыл бұрын

    Hey! First time I hear about this attribute of the image element. Is it almost new? Is your invention???

  • @safintheship
    @safintheship3 жыл бұрын

    Thanks

  • @alpachino468
    @alpachino4684 ай бұрын

    Does this work with just images or any HTML elements? I have a list of article posts on a page, each one having a containing div Is it possible to lazy load these divs with the method shown in the vid?

  • @deliriumcode
    @deliriumcode3 жыл бұрын

    Thank you for this! One additional question: Is there any possibility to start load (showing in browser) images completed (as a size) in their frames juts blurred, and as browser loads them - they become more clearer? Cheers!

  • @senorzed6483

    @senorzed6483

    3 жыл бұрын

    I have the same question! let me know if you find a solution please, thanks!

  • @mohamedruslicali5926

    @mohamedruslicali5926

    3 жыл бұрын

    Same question.

  • @vladimiranusic1988
    @vladimiranusic19883 жыл бұрын

    I haven't watch all of the video You made Kevin, but You gave me a lot of knowledge that is hidden sometimes in this world. My question is, You never mentioned optimizing images JPG SVG or PNG cause We as developers often, are given images from various sites when JPG image is 10MB large.. and that CAN NOT come on server caues it will take time to download.. Ok we have better machines now but speeeeed is still important.. not everybody have dev machine as we have on job or home.. Some tools I use every day are guetzly, optipng, svgcelaner.. and when you test your site online it makes more speed and Google likes it more.. Thanks..

  • @KevinPowell

    @KevinPowell

    3 жыл бұрын

    I have a series on this, where I look at webp and the picture element as well. I do need to look at automating it all though!

  • @andrewrea2799
    @andrewrea27993 жыл бұрын

    Kevin, if you’re using scrset with multiple sizes (1x, 2x, etc) or art direction, what size to I tell the browser for lazy load?

  • @KevinPowell

    @KevinPowell

    3 жыл бұрын

    As long as you have it on the img as an attribute, you're good. It chooses which one it wants when it needs it from what I understand :)

  • @aspsa6246
    @aspsa62463 жыл бұрын

    Thank you for the video. As you noted, the "loading" attribute is not yet fully supported on HTML image and tags (see: caniuse.com/?search=lazy%20loading). Can you recommend a fallback in JS?

  • @SahraClayton
    @SahraClayton3 жыл бұрын

    Good video

  • @guersomfalcon7544
    @guersomfalcon75443 жыл бұрын

    10:20 Is html file order not followed when loading page elements?

  • @blackpurple9163
    @blackpurple9163 Жыл бұрын

    Just to confirm, if I put width and height in the img tag itself and set width: 100% and height: auto with css, the browser will still retain the space of that image in the viewpoint on responsive websites as well right?

  • @patrikhorny4989
    @patrikhorny49893 жыл бұрын

    Good to know that something like this exist, but it's still not compatible with Safari and IE Edge

  • @pdsnpsnldlqnop3330
    @pdsnpsnldlqnop33303 жыл бұрын

    The first 2k of the image is read in to get the dimensions, how does that work on server side?

  • @ArchimedesTrajano
    @ArchimedesTrajano3 жыл бұрын

    8:40 why bother removing loading="lazy", if it is in the view port the browser will load it as eager anyway that way you don't have to guess which ones should be lazily loaded.

  • @Sollace
    @Sollace3 жыл бұрын

    me: Oh cool! also me: *remembered he uses background-image and not tags* Oh...

  • @mohithguptakorangi1766

    @mohithguptakorangi1766

    3 жыл бұрын

    he used tags...

  • @Sollace

    @Sollace

    3 жыл бұрын

    @@mohithguptakorangi1766 Yes, and I used background-image. I had to convert all my stuff to image tags so I could use lazy loading.

  • @mohithguptakorangi1766

    @mohithguptakorangi1766

    3 жыл бұрын

    @@Sollace ohh i thought u were saying that he(Kevin) was using background img

  • @notDYLANCOWLEY
    @notDYLANCOWLEY3 жыл бұрын

    Hey Kevin, what do you think of the layoffs hitting Mozilla and the MDN teams?

  • @KevinPowell

    @KevinPowell

    3 жыл бұрын

    Sucks big time. Luckily the MDN should be safe since Microsoft, Apple, Samsung and more have contribute to it as well. Bit worried about where Firefox is going from here though.

  • @notDYLANCOWLEY

    @notDYLANCOWLEY

    3 жыл бұрын

    @@KevinPowell Yeah Im really curious as to what the future of Mozilla is going to look like now. Thanks for the reply, and the great content by the way. You are a gifted teacher when it comes to front end and explaining advanced concepts in a very simple way.

  • @MikeMcCollister
    @MikeMcCollister3 жыл бұрын

    Nice video. I've added lazy loading to my page with very little effort. You noted around 13:06 using "max-width:100% and height:auto;" will keep the images proportional if the width and height are assigned as attributes. I've been doing this for a while but and it works fine on Chrome but I can't get this to work on Safari on iOS as it only does the width and the height is 0 until the image gets loaded. Is there a way to get that to work in Safari on iOS?

  • @KevinPowell

    @KevinPowell

    3 жыл бұрын

    That's interesting. I'll have to look into it more. I wonder if it'll be fixed once Safari pulls this out from behind a flag. Really strange since Safari was the first of the browsers to implement aspect ratios for images based on the width + height attributes....

  • @MikeMcCollister

    @MikeMcCollister

    3 жыл бұрын

    @@KevinPowell I enabled "Lazy Image Loading" on iOS Safari and did not see the lazy loading happen. Possibly my network speed is too fast and I can't tell. I looked around at some of other experimental Webkit features and did not find anything that might have to do with proportional images.

  • @stiviniii
    @stiviniii3 жыл бұрын

    I have a blog with many posts I cant go to each individual article and edit the img tag, how will I be able to add this the each tag using script or anything else please advise

  • @lemmelovu
    @lemmelovu3 жыл бұрын

    Hey kevin , a question. At 6:35, why did all the images load when just a single image was in the viewport? If thats the normal behaviour, then whats the point of 8:07? My mind id bending.

  • @robertlinder8464

    @robertlinder8464

    3 жыл бұрын

    The browser will download images within 3x~ the viewport height, this is so that images have time to load before they're actually displayed to the user.

  • @vishsingh7235
    @vishsingh72353 жыл бұрын

    Hey Kevin - do you know how (or if) this would affect images in a Single Page Application built with something like React? My understanding is that the entire site is transferred over on initial load so the client just handles rendering resources. Does it obviate the need for lazy loading?

  • @ManInSombrero

    @ManInSombrero

    3 жыл бұрын

    A React app contains only links to images, not images themselves. SPA or not it doesn't matter here.

  • @vishsingh7235

    @vishsingh7235

    3 жыл бұрын

    @@ManInSombrero I've made React apps that include local images on the server as well as projects with images that are hosted elsewhere and included via a web address.

  • @RicardoBuquet
    @RicardoBuquet3 жыл бұрын

    Those jump you are talking about also affects google's ranking.

  • @shineymcshine
    @shineymcshine3 жыл бұрын

    To stop WordPress 5.5+ from automatically adding a loading="lazy" tag to your first few, above-the-fold images, it seems you need to specify loading="eager"

  • @arthzdeceva484

    @arthzdeceva484

    3 жыл бұрын

    WP 5.5+ does that? And yes, I'm too lazy to read the changelogs...

  • @jarosk1977
    @jarosk19773 жыл бұрын

    I wonder Kevin, how would you lazy load CSS background images.

  • @isaactfa

    @isaactfa

    3 жыл бұрын

    You'll have to do it with the Intersection Observer API, but you can do it. Here's a handy article: imagekit.io/blog/lazy-loading-images-complete-guide/#lazy-loading-css-background-images

  • @OMorningStar
    @OMorningStar3 жыл бұрын

    Can it be combined with fade in animations?

  • @densfloar
    @densfloar3 жыл бұрын

    How about making a video of applying this to shopify themes? 😉

  • @Tassaczek
    @Tassaczek2 жыл бұрын

    How to make a "placeholder" with some color, for pictures? So it will not be white? Or some loader?

  • @waynehendricks1529
    @waynehendricks15293 жыл бұрын

    Its also useful to add a low res or blurred placeholder image to avoid the mass of white-space while the image is loading. Like this:

  • @mcvgs1780

    @mcvgs1780

    3 жыл бұрын

    Is the data-src attribute the one that will show the skeleton loading image? Is it this a built in attribute?

  • @samkeen

    @samkeen

    3 жыл бұрын

    Marc Vegas15 no, and this example’s the wrong way round. The full sized image should be in data-src, which is a custom data attribute that the browser doesn’t understand, but can be manipulated with JS. You then put the small image in src to load first, then when your JS kicks in you can have it transfer the data-src info into src.

  • @icaras12x87
    @icaras12x873 жыл бұрын

    I love the simplicity of the native method, but I would love to load some kind of preview image before the actual image, is that possible ?

  • @KBael

    @KBael

    3 жыл бұрын

    As long as it's got a width and height, just add a placeholder image with CSS by setting a background-image.

  • @GP-yc2it

    @GP-yc2it

    3 жыл бұрын

    @@KBael yes, or just a background color... maybe a nice gradient.

  • @frankdrolet9439
    @frankdrolet94392 жыл бұрын

    Is there a way to integrate this in a page builder like Oxygen, Elementor, or Divi?

  • @travezripley
    @travezripley3 жыл бұрын

    Lazies!

  • @KevinPowell

    @KevinPowell

    3 жыл бұрын

    😂😂

  • @emmanuelalcime1321
    @emmanuelalcime13212 жыл бұрын

    can you add a loading gif to indicate there is an image loading?

  • @justinoneill2837
    @justinoneill28373 жыл бұрын

    so freegin awesome

  • @leonardodilena680
    @leonardodilena6803 жыл бұрын

    Very interesting, but as a user most of the time I have no problem to load all the images as the page load, I'll wait. It's annoying for me to wait while scrolling the page instead.

  • @bryphillips
    @bryphillips3 жыл бұрын

    WCAG accessibility calls you out for not setting image h/w because it causes pah=ge loading "jumping" around

  • @DerSolinski
    @DerSolinski3 жыл бұрын

    Nice, now potatoes got more use. Granted only if they have a modern browser. But it is still a net plus for everyone.