Hi,
I was wondering if there’s a way to prevent an image to be loaded if the screen width is lower then a certain value, let’s say 480px. I know you can hide it by doing “display:none” inside a CSS media query, but that won’t prevent the image to be downloaded by the browser.
In case somebody will ask the same question:
I solved the problem by editing the twig template so the image URL is placed in the data-src attribute, and copied by JS in the src attribute only if the screen width is bigger than 480px. Here’s the code: