lazysizes icon indicating copy to clipboard operation
lazysizes copied to clipboard

Can i use css spinner loading while the image is Lazy loaded?

Open matinwd opened this issue 2 years ago • 4 comments

Hey. I hope you response my question. I wanna know if i can handle a spinner load while images are Lazy loading

matinwd avatar Dec 11 '21 01:12 matinwd

Hi, check the CSS API section of the docs here.

lspoor avatar Dec 25 '21 11:12 lspoor

Its possible, but its not possible to fade them in after an image was loaded.

ownHormez avatar Sep 08 '22 15:09 ownHormez

Its possible, but its not possible to fade them in after an image was loaded.

What reason would you show it after the image is loaded? The OP asked while the image are loading.

lspoor avatar Sep 08 '22 15:09 lspoor

Basic example:

  1. You like to show a loading icon while the image is loading - customer sees there is going on something.
  2. After the loading is completed, you like to fade them in, not show them just in the same second.

Just from the tech aspect I'm fine, the images are lazy loaded. But if you like to show them with some animation you current can't just easy addEventListener('beforePrintingImage', addCoolAnimationClass.bind). You know?

Currently if you try:

.lazyload,.lazyloading:

  • background-image: url('spinner');

and

.lazyloaded:

  • opacity: 0;
  • animation from opacity: 0 to opacity: 1

Then the image will show a millisecond and then the lazyloaded will be provided. ""This is a little bug (or may not bug its a feature, but you know what i mean)"" , the lazyloaded should show after printing not just when the resource was downloaded.

ownHormez avatar Sep 08 '22 15:09 ownHormez