biati-digital / glightbox

Pure Javascript lightbox with mobile support. It can handle images, videos with autoplay, inline content and iframes
MIT License
2.01k stars 226 forks source link

Avif with jpeg fallback #451

Closed kasperkamperman closed 10 months ago

kasperkamperman commented 10 months ago

Important. Is see Avif extensions are supported (based on other closed issue)

Please describe the feature you want to be implemented. It think it's needed to offer a fallback to jpeg when using avif, jpegxl or webp. I reviewed several lightbox solutions and no-one seems to offer this.

Explain why the feature is useful Newer browsers use AVIF, so images load faster, less bandwidth is used for the same quality. Older browsers fallback to JPEG.

Have you seen it somewhere else? I use this now for my thumbnails, a combination of img srcset (for responsive loading) and source srcset, wrapped in the picture tag.

<picture>
     <source srcset="photo_1600.avif 1600w, photo_800.avif 800w" sizes="100vw" type="image/avif" >
     <img src="photo_800.jpg" srcset="photo_1600.jpg 1600w, photo_800.jpg 800w" sizes="100vw" alt="Description of the image">
</picture>

Additional context If there is already some workaround (I , I'd like to know, however I couldn't find it in the documentation.

gingerchew commented 10 months ago

Related Issue: #361

Going to close this.