sachinchoolur / lightGallery

A customizable, modular, responsive, lightbox gallery plugin.

Home Page:https://www.lightgalleryjs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Thumbnail plugin ignores srcset; always loads default format

hracik opened this issue · comments

Description

When using multiple image formats e.g AVIF, WEBP with fallback to JPG/PNG thumbnail always loads default format. Is there a way to provide srcset for thumnails? So AVIF can be loaded in case it is supported by browser?

Steps to reproduce

Run the code bellow, simple gallery with AVIF as default format and JPG fallback. JPG image is always loaded in console just for Thumbnail plugin.

JS code that you use to initialize lightGallery.

lightGallery(document.getElementById('lightgallery'), {
   plugins: [lgThumbnail],
   download: false,
   speed: 500,
});

Sample HTML markup

<div id="lightgallery">
    <a data-src="/build/images/reality/novenabrezie/4.jpg" data-sources='[{"srcset": "/build/images/reality/novenabrezie/4.avif", "type":"image/avif"}]'>
        <picture>
            <source type="image/avif" srcset="/build/images/reality/novenabrezie/4.avif">
            <source type="image/jpg" srcset="/build/images/reality/novenabrezie/4.jpg">
            <img class="img-fluid h-100" src="/build/images/reality/novenabrezie/4.jpg" alt="Poprad - Nové nábrežie H403">
        </picture>
    </a>
</div>

Environment

  • Browser and version - Chrome/Firefox
  • OS - Windows 10
  • lightGallery version - current

At the moment, thumbnails don't support Picture tag.

I'll try to implement it in the coming version

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

commented

Any news on this?