Plugin Support
qtwrk
(@qtwrk)
Hi,
Well , actually I am not sure sure , but you can try
If not, maybe in the future ?
in case it can’t , you can use 3rd party lazyload plugin with LSCWP , as long as you don’t enable lazyload on both part , it should be fine
WP 5.5 will come with native lazyload on its own , so we will see what do we do when it releases
Best regards,
How can I try ? Do you use a specific JS library ?
And, I’ve checked the roadmap of WP 5.5, it looks like lazyload should apply only on
.
Plugin Support
qtwrk
(@qtwrk)
Hi,
Huh ? you can install LSCWP, enable lazyload to try
Best regards,
It won’t work without some trick. I tried, and it did not work. And you’ve already said it was in your to-do : https://wordpress.org/support/topic/lazy-load-background-images-4/
That is why I asked you if LS uses a specific JS library. For example, WP Rocket uses https://github.com/verlok/vanilla-lazyload, which can lazyload background image using data-bg attributes.
Ok, I found a solution. For the others, you may add a function like this, to manually add a data-bg attribute to your div or anything else. And add a data-lazyloaded attribute to this same div.
It works, but I was expecting to add a class instead of ‘data-lazyloaded’.
(function($) {
'use strict';
$('#section-69-5381').attr('data-bg', 'url(https://yourwebsite.fr/wp-content/uploads/2020/07/couv_noct.webp)');
$('#section-69-5381').attr('data-lazyloaded','');
}(jQuery));