Retina Support
MelchnerRoman opened this issue · 4 comments
MelchnerRoman commented
First thanks for this amazing Script.
There´s only one thing i'm missing. Is it possible to target Retina devices?
Cheers,
Roman
ivopetkov commented
Actually, this is built into the library. Search for window.devicePixelRatio
in the JS file.
MelchnerRoman commented
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">
ivopetkov commented
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.
MelchnerRoman commented
Alright now i see :) thank you!