Home › Forums › WoodMart support forum › Woodmart lazy loading implementation › Reply To: Woodmart lazy loading implementation
horny_fungus
I want to return to the problem of lazy loading of first image.
It’s rather important, as currently there’s no optimal solution:
– when Woodmart lazy loading is enabled first image loading is postponed which leads to worse LCP time
– when Woodmart lazy loading is disabled native browser lazy loading does not handle consecutive product images on single product page, so they are loaded only when user clicks arrow button (problem with single product page described here – https://xtemos.com/forums/topic/product-gallery-images-loaded-only-on-click/#post-347340). I am not quite sure why it happens as with default themes usually all carousel images are loaded immediately.
Can you please describe in more details how wd-lazy-load
class is applied? I tried to adopt following code – https://stackoverflow.com/a/65326178/12100478 to remove the class from first images but with no success, it seems like the class is added via JS as I can’t remove it via PHP snippet.
Also WordPress introduced some mechanism to avoid lazy loading for first image in WP 5.9 – https://make.wordpress.org/core/2021/12/29/enhanced-lazy-loading-performance-in-5-9/
So maybe you should examine these solutions and develop something similar for Woodmart?