0

I thought that CSS @media query will work with pinch-zoom on iOS devices this way - user zoom an image and since the "area" become larger @media "replace" this image with larger(hq) one if it is present in a code (spoiler: I was wrong).

So, I start implementing it, code example:

<picture> 
<source media="(max-width: 300px) and (orientation: portrait)" srcset="/image_1_1.png 1x, /image_1_2.png 2x, image_1_3.png 3x" /> 
<source media="(max-width: 500px) and (orientation: landscape)" srcset="/image_2_1.png 1x, /image_2_2.png 2x, image_2_3.png 3x" />
</picture>

I have a hi-res images on my site, and I simply cover all main screen size same way as in example above to reduce the load on devices with smaller screen, but when I tried to zoom in on it on iOS device nothing is happened, the image is just became lower in quality, no large one is replacing this smaller one.

I want to reduce the load time and bandwidth on devices which has no need in HQ graphics on page load, but if users want to take a closer look on images (zoom) they be provided with HQ copy of zoomed image.

How it can be done? (iOS compatible, pure CSS only)

//Yes, I saw other topics on this subject and in some of them I noticed that @media rules have to be applied automatically when zoom event occurs, but as I explained above, not in my case (addressing possible duplicate question mark).

  • Possible duplicate of [Media Queries for Different zoom Levels of Browser](https://stackoverflow.com/questions/22223866/media-queries-for-different-zoom-levels-of-browser) – Bonnie Sep 18 '18 at 18:07
  • If the duplicate doesn't work, you can try a media query with the `resolution` media feature. (I don't have an iPhone here, so I can't test.) – Mr Lister Sep 18 '18 at 18:31

0 Answers0