Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling the loading of animated gif 1

Status
Not open for further replies.

Ineedjava

Technical User
Apr 14, 2001
21
US
On a home page, I am using an animated gif that has about 25 frames in it.

Presently, the animation starts to play while it is still downloading, which does not look very good.

Is there some way to deploy Javascript so that the animation does not begin playing until it is fully downloaded?
 
Two thoughts,

You could pre-load the animated gif, use a non-animated placeholder image, then use the body onload event to swap out the image.

Or you could use a non-javascript method and write <image lowsrc=&quot;static.gif&quot; src=&quot;animated.gif&quot;>. Dont know if this will achieve desired effect, but worth a try.

Cheers,
Petey
 
Well, your answer was very helpful and got me thinking about the solution.

For some strange reason, I can't get the low resolution gif file specified in the <img lowsrc=&quot;static.gif&quot; ...> statement to show up in Internet Explorer 5.5. I have posted a question about this in the HTML forum.

I've also programmed a Javascript solution by preloading the large animated image, and then swapping it for the static placeholder image.

The Body onload= did not turn out to work very well for triggering the swap because the body of the web page fully loaded (triggering the onload statement) before the animated gif had fully downloaded. So all I have to do now is track down the javascript code that tests for when an image has been fully downloaded and then use that test as a trigger for swapping the animated image with the static placeholder image. Thanks for your help.
 
um...onLoad should not go until the whole page is loaded... -Greg :-Q

flaga.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top