aFarkas / lazysizes

High performance and SEO friendly lazy loader for images (responsive and normal), iframes and more, that detects any visibility changes triggered through user interaction, CSS or JavaScript without configuration.
MIT License
17.48k stars 1.73k forks source link

Hi #197

Open avinashksmeindia opened 8 years ago

avinashksmeindia commented 8 years ago

Image load time the loader is not visible using the css for the same.

.lazyload { opacity: 0; }

.lazyloading { opacity: 1; transition: opacity 300ms; background: #f7f7f7 url(loader.gif) no-repeat center; }

aFarkas commented 8 years ago

This should in general depend on the browser in combination with your markup.

The code above should simply just work in Chrome. While it might work or not in Firefox depending on your markup.

If you add a src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" to your images it should also work in FF.

Also note: That you should use a expand value, that ensures that a normal user shouldn't see an image loading. What you want is lazyloading in the background, but the user shouldn't notice that lazyloading was used.

Please close if this answers your question.

avinashksmeindia commented 8 years ago

Yeah i have added expand but i am not able to see the gif on even chrome.

avinashksmeindia commented 8 years ago

But the fadeIn effect is working according to the css opacity 0 to 1

avinashksmeindia commented 8 years ago

Actually when i am using data-src the loader appears but the image is also visible in the back and is getting loaded but when i use src or ng-src the fadeIn effect works but the loader gif is not visible.

aFarkas commented 8 years ago

I don't really understand what you mean. Here is an example.

https://jsfiddle.net/trixta/voferc4o/3/embedded/result/

  1. you see a fadein of the loader.
  2. the loader.
  3. the image.

Maybe you demonstrate your issue.

avinashksmeindia commented 8 years ago

Is it possible that the i can show the same result using ?

avinashksmeindia commented 8 years ago

the code <//img src=//"imagepath" class=//"lazyload" //> Without the forward slash

aFarkas commented 8 years ago

If you use a src with the normal image and no transparent image, there is no lazyloading involved. You need:

<img data-src="imagepath" class="lazyload" />

Use the following markup to show code blocks btw:

your code

And the following for inline code: your code