lazysizes icon indicating copy to clipboard operation
lazysizes copied to clipboard

Always loading largest size

Open marcmayo opened this issue 2 years ago • 1 comments

We have implemented lazy sizes on the header image here: https://www.star-registration.com/pages/sympathy-gift-for-funeral unfortunately, it always loads the 900px image no matter the device width.

I already tried to remove all css classes, set data-aspectratio and every other quickfix that can be found on the internet. Any help would be appreciated

marcmayo avatar Sep 22 '21 15:09 marcmayo

You need to either replace src with data-src (see https://github.com/aFarkas/lazysizes/tree/5.3.1#combine-data-srcset-with-data-src) or add an empty placeholder image in srcset (see https://github.com/aFarkas/lazysizes/tree/5.3.1#modern-transparent-srcset-pattern). Otherwise the browser will always load what it finds in src.

kid4git avatar Dec 15 '21 11:12 kid4git