How to display loading image before loading full image?

Question & AnswersCategory: GeneralHow to display loading image before loading full image?
Vivek asked 2 years ago

I want to show the loader image before loading the full image. Otherwise the broken image is showing & Website image box showing blank content. I have tried using JS, but not working. How can I solve this problem?

1 Answers
Chandan Sharma Staff answered 2 years ago

We can show a loader image , untill the full image downloaded. this problem can be solved using javascript show() & hide().
 
we can do it simply by adding a background loader image.
like:

img {
     background: url('loading.gif') no-repeat;
}

 
when actual image downloads, the background image will hide simply.