0

Is there any way to show a loading image while loading a image?

4
  • are you talking about the same image, or show another image while one is loading? Commented Jun 8, 2009 at 19:45
  • Show one image while loading loading another. Commented Jun 8, 2009 at 19:48
  • so you want a "loading" picture to show until real image fully loaded? Commented Jun 8, 2009 at 19:50
  • yes that is exaktly what i want! Commented Jun 8, 2009 at 19:56

1 Answer 1

1

The easiest way would be to set a background image with css on the img element (or the containing element) - no javascript needed (you will, of course, need to set dimensions on the img tag)

If you want to ensure the image isnt displayed until fully loaded you can use this technique.

Sign up to request clarification or add additional context in comments.

2 Comments

That would not be 100% good solution as a modem user might see the image loading from top to bottom.
To overcome that, you would need to preload the image with javascript and then replace it. Theres an example here: jqueryfordesigners.com/image-loading

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.