Re: Defer offscreen images in Shopify

How can we defer offscreen images from a CDN?

maroofimran
Tourist
16 0 1

How can we Defer offscreen images in Shopify when images are coming from Shopify cdn?

Replies 7 (7)

Liquid_xPert_SJ
Shopify Partner
1190 130 167

Hi @maroofimran Welcome to the Shopify Community,

 

If the cdn is used by your theme or store then you can set a class of "Lazy" or "Lazyload" for the image tag example below

<img class="lazyload" src="yourimage.png" />

in this way you can defer off screen images. 

 

Thanks

- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂
maroofimran
Tourist
16 0 1

in which .liquid file I should place this lazyload?

Liquid_xPert_SJ
Shopify Partner
1190 130 167

@maroofimran 

 

can you please confirm which theme you are using. its depends on the theme structure if the issue is on collection page the file will be different if the issue on the product page also the issue has been different so can you please explain on which page you are trying defer image ?

 

Thanks

- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂
maroofimran
Tourist
16 0 1

I am trying to defer images on my main home page or also on product pages and I am using focal theme.

Liquid_xPert_SJ
Shopify Partner
1190 130 167

Hi @maroofimran 

 

find media.liquid, or product-media.liquid and find <img> tag and add class of "lazyload" in that and hit save and test it. also please let me know if i can help you on this.

 

Thanks

- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂
maroofimran
Tourist
16 0 1

not working same error I tried loading="lazy" also class="lazyload"

Liquid_xPert_SJ
Shopify Partner
1190 130 167

@maroofimran

Can you please confirm if i can do it for you? 

Thanks 

- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂