Hi all - I’m trying to find a way to show responsive images (using srcset) but lazyloaded. Even though it does use lazysizes, the srcset plugin unfortunately doesn’t seem to natively offer lazysizes’ bgset extension (which allows me to use ‘data-bgset’). Does anyone know a way around this, perhaps another plugin altogether, or a new function I’m unaware of or maybe a way of using the bgset extension in combination with the existing plugin?
I of course could not use background images and use only images, but for a variety of reasons I really need to rely on background images in this scenario.
Thanks for the hand - I tried that without luck but am surely doing something wrong. For now I’ve decided to drop the background image support, but while I have you, am presented with this problem: ‘Call to a member function lazysrcset() on string’ when using this code:
my plugin filemethod lazysrcset() does create the full image element (even some style element). you should not use it on the url() i know this is a bit confusing but since my plugin was created before kirby had any sort of srcset support the naming is a bit misleading. maybe i should rename my file method to “imageElementWithLazySrcset” .