Shopify themes, liquid, logos, and UX
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.
Hi @Runner
You can do that by finding and removing this part of code loading="lazy" or loading: 'lazy' from liquid files
- Helpful? Like and Accept solution! or Buy me coffee
- 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.
- Ryviu: Aliexpress Reviews - AliExpress Reviews Importer, one-click import aliexpress reviews, export reviews to CSV file.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
Which liquid files would have those parts of the code? I can not find those parts of the code in my theme.liquid
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?
Hi, you can see theme in listed file below:
- Helpful? Like and Accept solution! or Buy me coffee
- 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.
- Ryviu: Aliexpress Reviews - AliExpress Reviews Importer, one-click import aliexpress reviews, export reviews to CSV file.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
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?
Which images? Could you share the link to your page?
- Helpful? Like and Accept solution! or Buy me coffee
- 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.
- Ryviu: Aliexpress Reviews - AliExpress Reviews Importer, one-click import aliexpress reviews, export reviews to CSV file.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
It would be the first few images, that I see are the problem.
Try using this script and place it in your theme.liquid file
Log in to Your Shopify Admin:
Navigate to Themes:
Access Theme Code:
Locate the theme.liquid File:
Edit the theme. liquid File:
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 it as a solution.
If you need an expert Shopify developer for customization and development, feel free to contact me via email or WhatsApp.
Email: [email protected]
WhatsApp: +92 343 0211536
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024