is my Lazy loading code correct?

is my Lazy loading code correct?

Jdierck
Tourist
24 0 1

I am unsure if the code i implemented into our store and was wondering if someone could verify that it is correct.

 

The code is 

{{
'//cdnjs.cloudflare.com/ajax/libs/jquery.lazyload/1.9.1/jquery.lazyload.min.js'
| script_tag }}

Screenshot 2024-09-10 at 5.17.11 PM.png

Please let me know if this is correct or not! any thought helps.

Replies 5 (5)

PaulNewton
Shopify Partner
7222 637 1499

What matters is...   what does it actually render as, check the source of the actual website in the browser: ctrl+u

 

As for lazyloading as a feature that's only the part that loads the script, it does not account for what the rest of the theme may or may not be doing.

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


Jdierck
Tourist
24 0 1

any idea how to actually add lazy loading then? if thats only for the script.

 

Thank you!

 

PaulNewton
Shopify Partner
7222 637 1499

@Jdierck Implementation will vary wildly among themes some themes already have it or similar pre setup code to support the feature.

See the docs for the library being used, the themes code or themes doces , combined with shopify theme development.

https://shopify.dev/docs/themes 

 

Past that realize your asking a massively broad question that is beyond a simple forum contribution about a custom implementation for a common web-development pattern.

 

If you need this website speed theme customization done for you and have the budget then contact me by my email for services.
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


Dan-From-Ryviu
Shopify Partner
9668 1936 1971

Hi @Jdierck 

Every shopify theme has a lazyload function by default. Why do you need to add a lazy load library? It could affect the speed score of your site. 

- Helpful? Like and Accept solution! Support me! 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.

PageFly-Richard
Shopify Partner
4668 1069 1726

Hi @Jdierck 

 

This is Richard from PageFly - Shopify Page Builder App

 

Using an external library for what already exists for your theme is not an optimal way.

 

Instead of adding the library which changes no thing or even slow down your site, i suggest you should check on your theme script and enable it. Infact its just an image attribute as loading="lazy"

 

Hope this can help you solve the issue 

 

Best regards,

Richard | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available) 


All features are available from Free plan. Live Chat Support is available 24/7.