lightGallery icon indicating copy to clipboard operation
lightGallery copied to clipboard

gallery to show a placeholder when size is specified in the img tag

Open aguaviva opened this issue 2 years ago • 2 comments

Summary

gallery to show a placeholder when size is specified in the img tag,

Basic example

facebook does that, but I think the idea is clear

Motivation

This will stop images popping up and layout recalculations, a thing that slows down and confuses the user. This is specially useful with slow networks or big galleries.

aguaviva avatar Aug 01 '22 23:08 aguaviva

Hey @aguaviva,

lightGallery already uses the thumbnails as a placeholder for the large images. When you click on the thumbnails(outside the gallery), the current thumbnail is resized and displayed until the actual image is loaded.

sachinchoolur avatar Aug 03 '22 06:08 sachinchoolur

Hey @sachinchoolur

By a placeholder I meant a rectangle of a solid color, Facebook uses a blue one, that shows up until its thumbnail loads.

The placeholder has only a color and the dimensions of the placeholder, this way the browser calculates they layout just once and then replaces the placeholders with the thumbnails, this also solves the problem of multiple layout recalculations and images popping.

aguaviva avatar Aug 03 '22 13:08 aguaviva

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.

stale[bot] avatar Oct 02 '22 20:10 stale[bot]