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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pre-loading GIF while animated GIF is loading

Status
Not open for further replies.

dottieandbelle

Technical User
Feb 29, 2004
8
US
I have a fairly image-intensive page that has an animated GIF logo, and I'd like the page to be able to load in its entirety (including a still GIF version of the logo that's the same as first frame of animation) before the animated GIF loads so that it's a seamless experience. Does anyone know some JavaScript or other code to accomplish this?

Any advice would be great! Thanks...
 
But how do I get the animated GIF to load last? The lowsrc thing allows the animated GIF to load while the still one is in place (which is great, by the way), but the animation is still starting (and ending) before the rest of the page is finished loading.
 
Sorry - I mis-read your post. If you want to wait for the whole page to finish loading, you can use something like this:

Code:
<script type="text/javascript">
<!--

   onload = setupPage;

   function setupPage() {
      document.getElementById('myLogo').src = 'someAnimatedLogo.gif';
   }

//-->
</script>

...

<img src="stillFrame.gif" width="100" height="50" alt="My logo" id="myLogo" />

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top