Archived topic
Remove lazyload from Page hero background image
5 replies · Started by Canek on July 19, 2021
Hello,
I am using Wp Rocket and I want the background custom image of the page hero of the category blogs to be excluded from lazyloading and if possible to preload them.
Is there anything I can do?
Thanks
Hi Canek,
I suggest checking WP Rocket's documentation about this as the theme doesn't control the WP Rocket's functionalities.
I did a bit of research for you and lead me to this - https://docs.wp-rocket.me/article/1144-disable-lazyload-on-background-images
It's worth checking out. :D
Thanks for the reply.
What I mean is that I can't find any image "class" of the Page hero background image, to be able to lazyload it as the article you share says.
How can I know the image "class" to exclude the background images from the categories?
Thank you
Hi there,
the background image isn't being lazyloaded - very few plugins provide lazy loading for CSS backgrounds, their generally a paid server side option.
The delay in it being displayed is because its a CSS Background image, the request for that image doesn't get made until the sites CSS is loaded, whereas an <img> element the request is made during the HTML loading stage.
With a custom background image there isn't any easy way to improve its loading, without manually coding the CSS for each place your using the a custom background hero.
Okay. Thank you very much for the information.
Very useful.
Thanks for everything.
You're welcome