What's your biggest current challenge? Have your say in Community Polls along the right column.

Re: How do I remove lazy loading on an image banner - Craft theme

How do I remove lazy loading on an image banner - Craft theme

stripedcircle
Visitor
3 0 1

Hi there - first time poster but long time user of this community board to resolve numerous issues 🙂

 

Can someone help me to set loading to eager on my Image Banner on my homepage, please?  It is currently set to lazy and this is impacting my LCP.  URL is https://stripedcircle.com if helpful!  I am currently using the Craft theme.

 

See below snip of Page Insights - but I can't see any code that sets loading to lazy in the image-banner.liquid file...

stripedcircle_0-1732816016736.png

Any advice gratefully received!

Many thanks, Tim.

Replies 5 (5)

Taknify
Shopify Partner
262 18 29

Why would you want to remove lazy loading? For users with slow internet speed, lazy loading actually helps because your image will load only if they are needed, instead of loading everything at once. But is it indeed true that removing lazy loading on "above the fold" content actually helps. 
I can help you out to check your theme code and remove that if you DM me your access.

Need to tweak your store for Black Friday? Simply, send me a message.

Ahmad31
Shopify Partner
112 9 8

 

  • Locate the File:

    • Go to Online Store > Themes > Actions > Edit Code.
    • Open image-banner.liquid (usually in the Sections folder).
  • Edit the <img> Tag:

    • Find the <img> tag, which might look like:
       

 

 

<img src="{{ image | img_url: '1600x' }}" alt="{{ image.alt | escape }}" loading="lazy">

 

 

Change it to :

 

 

<img src="{{ image | img_url: '1600x' }}" alt="{{ image.alt | escape }}" loading="eager" fetchpriority="high">

 

 

Save and Test:

 

Love my work? Buy me a coffee!
Hire Me: Email me Or Chat on Whatsapp
If you found my solution helpful, please like and accept it. Your support is greatly appreciated!

Dan-From-Ryviu
Shopify Partner
10296 2044 2115

Hi @stripedcircle 

Please go to your Online Store > Themes > Edit code > open Image-banner.liquid file, under this line of code 

sizes: sizes,

Paste this code and save file 

preload,

Screenshot 2024-11-29 at 08.39.50.png

- Helpful? Like and Accept solution! Or Support me: Buy Coffees
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

stripedcircle
Visitor
3 0 1

Thanks Dan.  Unfortunately, that hasn't improved the load delay on the LCP element.  PageSpeed Insights is still showing that image as lazy loading and the load delay is 7,680ms (53% of LCP).  Any other thoughts?

Website_Speedy
Shopify Partner
35 2 4

Hi @stripedcircle,

To improve the loading behavior of your image banner on your Shopify store, you can adjust the image’s loading settings to help it load faster, which can improve your Largest Contentful Paint (LCP) score and overall site performance.
Since you're using the Craft theme, here’s a simple way to do this:

Once you find the code, update the loading attribute to "eager" and set the fetchpriority to "high" to prioritize loading the banner image:

<img src="{{ image.src | img_url: 'original' }}" alt="{{ image.alt }}" class="banner-image" loading="eager" fetchpriority="high">


By making these adjustments, your banner image will load more quickly, which should help improve the LCP score and the overall speed of your store.


If these changes don’t result in the desired improvement in LCP, you might want to try the Website Speedy app from the Shopify App Store. It’s easy to set up and offers additional tools to boost performance and improve core web vitals. You can check it out here: https://apps.shopify.com/website-speedy

 

If helpful then please Like and Accept Solution.
Need help with optimizing the speed and performance of your website? Check out our app our app