I’m relatively new to Kirby and loving it so far. For lazy loading my images, I need to add a class to the generated tags around my images (e.g. <figure class='lazyloader'>
). What would be the correct way to do this?
Thanks in advance
Alex
I’m relatively new to Kirby and loving it so far. For lazy loading my images, I need to add a class to the generated tags around my images (e.g. <figure class='lazyloader'>
). What would be the correct way to do this?
Thanks in advance
Alex
Do you mean when adding images via the kirbytext image tag? You can pass a class like this:
(image: some_image.jpg class: some_class)
Thank you for your answer. But I forgot mentioning that I additionally need to extract a Kirby Image Field for the dominant color. I want to replace the figure tag with something like this:
<figure class="lazyloader" style="background-color: <?= $image->color() ?>">
</figure>
Alex
You can overwrite the original image tag. Make a copy of it and save it in the /site/tags
folder. Make changes as required.
Thanks a lot. I’m on the right track now.