automatic sizes feature: In case of lazy loading images the
sizes attribute of the
source elements can be calculated with JS.
This automatic sizes feature is directly included in lazySizes. Simply use the keyword
auto inside of the
data-sizes attributes (
sizes is calculated: The automatic sizes calculation takes the width of the image and the width of its parent element and uses the largest number of those two calculated numbers. It's therefore important, that all images are contained in a wrapper that isn't much bigger than the image should shown. Otherwise a wrong (too big) sizes attribute will be calculated.