How to add class to image tag?

Highlighted
New Member
1 0 0

Hey, does anyone know of a way to add a class "Lazyload" to my Shopify tag, I was reading an article of deferring offscreen image written by Punit Sethi. The link is https://www.tezify.com/how-to/defer-offscreen-images/

 

I was got stuck in point #3,  

"Change the image tags in your theme by adding class “lazyload” to the image tags and changing the src attribute to data-src attribute" I don't know where I can add this code to my theme. I will be appreciated if someone could help me with this. Thank you 

deffer.png

0 Likes

Hi,

 

You should have developer skills for this task.

 

Link JS code at <head> tag, usually @ layout/theme.liquid file

Image tag depends of you theme, check templates/collection.liquid and templates/product.liquid files to find out how your theme generate img tag.

 

You can use online editor at Online store -> Themes -> Action -> Edit code

 

Best regards, Mari

Shopify App / Theme developer
https://mpthemes.net/
1 Like