Lazy Loading removes max-width from sizes attribute
-
We enabled Lazy Load and spotted that the max-width specified in sizes is being overridden.
In WordPress in the page we have specified to use the “Medium” image (300px width). The original image tag (before lazy loading enabled) shows as this:
The max-width setting is there under “sizes” attribute: sizes=”(max-width: 300px) 100vw, 300px”>
However, when Lazy Load was enabled the image tag was converted to:
The “sizes” attribute now shows just the current browser window width, and has lost the max-width setting: sizes=”1598px”
This has resulted in the 500px image being blown up to 1598px width, so terrible quality. How can I fix it so that Lazy Load respects max-width settings?
- The topic ‘Lazy Loading removes max-width from sizes attribute’ is closed to new replies.