stop lazy loading in Spotlight

stop lazy loading in Spotlight

Runner
New Member
6 0 0

I am trying to get my site to stop lazy loading images as its slows down my store speed, but I can't find the code in the Spotlight theme I am using to fix that, nor do I know of any other way to stop the images from lazy loading. Any help would be appreciated.

Replies 9 (9)

Dan-From-Ryviu
Shopify Partner
11288 2212 2381

Hi @Runner 

You can do that by finding and removing this part of code loading="lazy" or loading: 'lazy' from liquid files

- Found this helpful? Hit "Like" and "Accept as Solution"! - Feeling generous. Buy me coffee!
- 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 - Gain customers with photo gallery, video & shoppable image
Built for Shopify

Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...
Sign up now.

Runner
New Member
6 0 0

Which liquid files would have those parts of the code? I can not find those parts of the code in my theme.liquid 

Runner
New Member
6 0 0

To clarify on my side, my store's theme, Spotlight, doesn't have the exact lines of loading="lazy" or loading: 'lazy' in any of its liquid files, so I don't know if it would be in another line of code that would stop the lazy loading for images? Or if it's part of a Javascript file?

Dan-From-Ryviu
Shopify Partner
11288 2212 2381

Hi, you can see theme in listed file below:

  • slideshow.liquid
  • product-media.liquid
  • product-media-gallery.liquid

- Found this helpful? Hit "Like" and "Accept as Solution"! - Feeling generous. Buy me coffee!
- 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 - Gain customers with photo gallery, video & shoppable image
Built for Shopify

Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...
Sign up now.

Runner
New Member
6 0 0

Hello @Dan-From-Ryviu!

I appreciate the further guidance, I have found the code in those pages and have removed it, but I am not sure if that has exactly worked as, according to Google Lighthouse, the images are still being lazy loaded. Thoughts on this?

Dan-From-Ryviu
Shopify Partner
11288 2212 2381

Which images? Could you share the link to your page? 

- Found this helpful? Hit "Like" and "Accept as Solution"! - Feeling generous. Buy me coffee!
- 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 - Gain customers with photo gallery, video & shoppable image
Built for Shopify

Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...
Sign up now.

Runner
New Member
6 0 0

Yes, here's the link to my page: www.runnersgogear.com 

Runner
New Member
6 0 0

It would be the first few images, that I see are the problem.

Mehran_Ali
Shopify Partner
462 63 69

Try using this script and place it in your theme.liquid file

  1. Log in to Your Shopify Admin:

    • Go to your Shopify admin dashboard.
  2. Navigate to Themes:

    • In the sidebar, click on "Online Store" and then "Themes."
  3. Access Theme Code:

    • Find the theme you want to edit, and click on the "Actions" button.
    • Select "Edit code" from the dropdown menu.
  4. Locate the theme.liquid File:

    • In the code editor, look for the theme.liquid file. It is usually located in the "Layout" folder.
  5. Edit the theme. liquid File:

    • Click on theme.liquid to open it and make your desired changes.
    • Don’t forget to save your changes after editing.

By following these steps, you can access and edit the theme.liquid file in your Shopify store.



 

<script>
$(document).ready(function() {
  // Remove the standard lazy loading attribute
  $('img[loading="lazy"]').each(function() {
    $(this).removeAttr('loading');
  });

  // Remove custom lazy loading attribute (e.g., data-lazy)
  $('img[data-lazy]').each(function() {
    $(this).removeAttr('data-lazy');
  });
});
</script>

 

  Note: make sure you check the attribute in the image tag for lazy load then replace that attribute in the script this will remove all lazy load attribute from the page 

-If this solution helps you, kindly LIKE THIS REPLY and MARK AS A SOLUTION OR

Buying Me A Coffee.

-If you need an expert Shopify developer for customization and development, feel free to contact me.


Email: Mehran.ali5300@gmail.com


WhatsApp: +92 343 0211536