ivopetkov/responsively-lazy

Retina Support

MelchnerRoman opened this issue · 4 comments

First thanks for this amazing Script.

There´s only one thing i'm missing. Is it possible to target Retina devices?

Cheers,
Roman

Actually, this is built into the library. Search for window.devicePixelRatio in the JS file.

Ah ok, and how do you implement in the html?
like this?

<img src="image-src.png" srcset="image-1x.png 1x, image-2x.png 2x,
                                 image-3x.png 3x, image-4x.png 4x">

No. You just specify different image versions, without things like 2x, 3x, ...

Example:
<img src="images/2500.jpg" data-srcset="images/400.jpg 400w, images/600.jpg 600w, ... "
If the available size is 300px (CSS pixels) and the device DPI is 2, then the 600w (300x2) file will be loaded.

Alright now i see :) thank you!