---
title: "Discussion on \"Implementing image lazy loading to improve website performance using JavaScript\" | Hashnode"
description: "Discussion on \"Implementing image lazy loading to improve website performance using JavaScript\". This article entails implementing lazy loading of images using JavaScript's Intersection observer API which improves the speed and performance of webpages."
url: "https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Implementing image lazy loading to improve website performance using JavaScript](https://daiveedjay.hashnode.dev/implementing-image-lazy-loading-to-improve-website-performance-using-javascript?utm_source=hashnode&utm_medium=feed)

This article entails implementing lazy loading of images using JavaScript's Intersection observer API which improves the speed and performance of webpages.

Nov 16, 2022 · 14 min read · daiveedjay.hashnode.dev  
Updated Nov 17, 2022  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#speed](https://hashnode.com/tag/speed)
-   [#optimization](https://hashnode.com/tag/optimization)
-   [#vanilla-js-1](https://hashnode.com/tag/vanilla-js-1)
-   [#observer](https://hashnode.com/tag/observer)

## Written by

[David Jaja](https://hashnode.com/@Daiveed)

@Daiveed

  
[View profile](https://hashnode.com/@Daiveed)

A frontend developer passionate about making topics easily comprehensible to beginners.

A front-end developer with a zeal to build interactive and user-satisfactory products.

## Responses 12

Markdown supported · ⌘↵ to post

[Abhinay Kumar](https://hashnode.com/@Abhinay674)

[Dec 10, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6394b27796f258092198f60a)

Hello, The question is not about lazy loading. Just wanted to ask u a question .I don't know how to approach JS projects.. totally confused. I was a beginner. Can u give me any advice??

[David Jaja](https://hashnode.com/@Daiveed)

[Dec 10, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6394b27796f258092198f60a#reply-6394bdcb15750808b269b103)

First, if you have a project in mind, I suggest you outline all the processes in writing i.e. all the functionalities your application will have. Next, you think of how each functionality will work and the logic behind it. You can even draw a flowchart of your whole application (something I do 😂) if you like. Don't worry, your flowchart wouldn't be perfect but it'll help you visualize your whole project better. At this point, you should have a better overview of how your application would work and be able to start building. Keep in mind that you may experience bugs while building, but with enough determination (and googling 😂), you should be able to build your projects.

[Can Rau](https://hashnode.com/@CanRau)

[Nov 24, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/637fa938345a39e5dafe16c1)

👏 great read! I'd like to add that a tiny base64 image can be a good blurry preview image which can be embedded in the html saving on round-trips for the previews or alternatively [blurha.sh](https://blurha.sh/) (used by e.g. Unsplash) which is similar but a little more involved.

And also consider addint a `<noscript>` with a decent version for when JS is disabled or fails for whatever reason, degrading loading but improving the UX 😉

[David Jaja](https://hashnode.com/@Daiveed)

[Nov 25, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/637fa938345a39e5dafe16c1#reply-6380976de806cdee4ae93ee9)

Yeah, I'd consider all these. Thanks for your feedback! Much appreciated. 😉

[Noah Pohl](https://hashnode.com/@Noah670)

[Nov 23, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/637d6ae4a4b809c7ba75274e)

Thanks for sharing, very helpful!

[David Jaja](https://hashnode.com/@Daiveed)

[Nov 23, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/637d6ae4a4b809c7ba75274e#reply-637e187ff223b9d3324967fd)

Thanks! ✌

[Clinton Joy](https://hashnode.com/@Cejay101)

[Nov 19, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6378476b4ecc88853c130f0d)

Very nice article, i enjoyed it.

[David Jaja](https://hashnode.com/@Daiveed)

[Nov 19, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6378476b4ecc88853c130f0d#reply-6378d509ce6f5c939e2818ae)

Thanks!

[Khadija Suleiman](https://hashnode.com/@joosama)

[Nov 18, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/63778d6603a790859a3f3cfe)

This is super awesome Jaja, well done👏🏾

[David Jaja](https://hashnode.com/@Daiveed)

[Nov 19, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/63778d6603a790859a3f3cfe#reply-6378d4edfeefdb9376a3a177)

Thanks! ✌

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[Nov 17, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/637667cff0820773cfb15a97)

A well written article [David Jaja](https://hashnode.com/@Daiveed). Intersection Observer is amazing. I have written an entire article covering various use cases of intersection observer with multiple demos: [bit.ly/3TJOPu8](http://bit.ly/3TJOPu8)

[Eric Kwoka](https://hashnode.com/@thekwoka)

[Nov 17, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6376579df0820773cfb15909)

Or just add `loading="lazy"` to the images.

Then you don't need any css or js

[David Jaja](https://hashnode.com/@Daiveed)

[Nov 17, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6376579df0820773cfb15909#reply-63766ba3abae2b7516a865bc)

Yeah, but using loading="lazy" isn't as flexible as using JavaScript's Intersection Observer to lazy-load images. Thanks for the feedback.👍

[Eric Kwoka](https://hashnode.com/@thekwoka)

[Nov 17, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6376579df0820773cfb15909#reply-63767929abae2b7516a86716)

[David Jaja](https://hashnode.com/@Daiveed) I disagree. It's much better, as it will adjust it's behavior based on the users devices settings (data/battery saver) and current network connection.

And it works beautifully with srcset and picture element, SEO, etc.

[David Jaja](https://hashnode.com/@Daiveed)

[Nov 17, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6376579df0820773cfb15909#reply-63768178f0820773cfb15d7d)

[Eric Kwoka](https://hashnode.com/@thekwoka) Well, there are a variety of ways you can implement image lazy-loading, whatever method you choose is entirely up to you.

[Jimoh Rildwan Adekunle](https://hashnode.com/@jimoh)

[Nov 17, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/637643e4f0820773cfb1569f)

A well-detailed article. It was an interesting read

[David Jaja](https://hashnode.com/@Daiveed)

[Nov 17, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/637643e4f0820773cfb1569f#reply-63764427dc823473f485b0e1)

Thanks, I really appreciate your feedback.👍

[Esther Mark](https://hashnode.com/@esther930)

[Nov 16, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/63751505e1d53a5fd290e830)

Amazing article, this was very helpful with going into details and explaining everything so well. Thank you

[David Jaja](https://hashnode.com/@Daiveed)

[Nov 16, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/63751505e1d53a5fd290e830#reply-63751ee52cab3a64dcb6c192)

Thank you!😉

[IB Hanmyo George](https://hashnode.com/@Hanmyo)

[Nov 16, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6374e06110b5395b66fa6abd)

Amazing write-up!. Thank you for being so helpful.

[David Jaja](https://hashnode.com/@Daiveed)

[Nov 16, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6374e06110b5395b66fa6abd#reply-6374ea7ce1d53a5fd290e3e0)

Thanks😉

[F. T Oraene](https://hashnode.com/@FOraene)

[Nov 16, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6374d0b4e1d53a5fd290dfce)

Great Job David….this was an interesting read

[David Jaja](https://hashnode.com/@Daiveed)

[Nov 16, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6374d0b4e1d53a5fd290dfce#reply-6374d2d910b5395b66fa6816)

Thanks!👌

[AWAJIMIJAAN ATAISI SILAS](https://hashnode.com/@mijaan)

[Nov 16, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6374b17e10b5395b66fa62d1)

Great concept Daiveed. It was a lovely and inspiring read.

[David Jaja](https://hashnode.com/@Daiveed)

[Nov 16, 2022](https://hashnode.com/posts/implementing-image-lazy-loading-to-improve-website-performance-using-javascript/6374a8d2f81d195c0f220048/comment/6374b17e10b5395b66fa62d1#reply-6374b54910b5395b66fa638d)

Thanks 😊
