Responsive variants for the main image in lightbox gallery

When creating a lightbox, only the thumbnail images get the srcset attribute for the image (img) tag. This is useful for the thumbnails, but a bit of an overkill as also an image with a width of 2000px gets added to the srcset list (not very common for a thumbnail). However, for the main image (the image that opens in the gallery when clicking or tapping on a thumbnail) does not have a srcset attribut at all. This means: the user agent has ALWAYS to download the largest image (as it is the original image) of the entire set. It's okay for a desktop user agent, but is a performance and bandwith overkill for a mobile user agent where you would expect to have the browser select the best image from the srcset list.

Wish: please include the srcset for the big image in the lightbox as well. This should not be a big thing, but will increase performance dramatically.

Regards

Bernhard

  • Sturm Bernhard
  • Sep 25 2017