Hello,
I'm looking for assistance with implementing responsive images in my Grav CMS site. I have two versions of images: 'horizontal.jpg' for desktop and 'vertical.jpg' for mobile devices.
Additionally, I'm using the image map where coordinates differ depending on which image to display.
I want to use Grav's built-in functionality to achieve the following:
- Display 'horizontal.jpg' for desktop devices with appropriate coordinates.
- Display 'vertical.jpg' for mobile devices with appropriate coordinates.
Here is the original code of the image with coordinates which is displayed on all devices:
<img loading="lazy" title="image title" usemap="#image-map" alt="my alt" src="{{ theme_url }}/images/001-full.jpg" style="object-fit: contain;width: 100%;height: 100%;display: block;">
<map name="image-map">
<area target="" href="#" coords="529,511,4,0" shape="rect">
<area target="" href="#" coords="1064,512,535,3" shape="rect">
<area target="" href="#" coords="1072,512,1599,1" shape="rect">
</map>
Or, maybe it's not possible to achieve the desired results with built-in Grav functionality?