I already have lazyloading in place for category product images.
I added a script to the head, added a class “lazyload” to each image, and changed the src to data-src.
This works perfectly.
I am now trying to change this for pagebuilder images.
so far, I have created my own module and added a class to the image.
File appcodemoduleLazyloadviewadminhtmlwebtemplatecontent-typeimagefull-widthmaster.html
I edited the class attribute to include “lazyload”
Code snippet:
<img if="data.desktop_image.attributes().src"
attr="data.desktop_image.attributes"
class="lazyload pagebuilder-mobile-hidden"
css="data.desktop_image.css"
ko-style="data.desktop_image.style" />
<img if="data.mobile_image.attributes().src"
attr="data.mobile_image.attributes"
class="lazyload pagebuilder-mobile-only"
css="data.mobile_image.css"
ko-style="data.mobile_image.style" />
All that is left to do is change the src to a data-src, but I am unsure where to change this.
I tested editing viewadminhtmlpagebuildercontent_typeimage.xml, but have been failing in implementation.
Any help would be appreciated.
Thanks!