Skip to content

How does unlazy handle retina displays? #12

Discussion options

You must be logged in to vote

Hi there!

The data-sizes="auto" feature is generally used to dynamically adjust the sizes attribute of your <img> element based on its display size: it updates the sizes attribute to the offsetWidth of the <img> element.

As for the retina display images, if you want to provide a 2x version for the retina display, you should include that in your data-srcset attribute, and the browser will select the appropriate image based on the device's pixel ratio and the image's declared width.
In your case, it looks like you're providing 3 different image widths (320, 640, and 1280 pixels). If a device with a pixel ratio of 2 was to display the image at a size of 640 pixels wide, it would ideally sele…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by johannschopplich
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants