Solved

GIF ANIM "Restart" and ONLOAD consistency

Posted on 1998-07-31
4
4,472 Views
Last Modified: 2013-11-19
Well I'm planning on using GIF ANIM for a small sequence of my webpage.  I have JS code which will actually replace one graphic for this GIF ANIM using: document[grfx].src="p/anim.gif";

I am using imagemaps and so there are a few HREFS inside <AREA> tags which call javascript functions to handle the click.  Now when I click on these imagemap areas, the GIF ANIM stops animating.  Why is that and exactly how can I "restart" or even prevent this from happening to my GIF anim? I would like to have the GIF anim continuously running.  I tried making a second call to the frozen GIF ANIM via the same: document[grfx].src="p/anim.gif" but it never restarted.

And one last question, when I click around via the imagemaps I use ONLOAD to tell me when a graphic is completely finished displaying (I would have used .COMPLETE but it doesn't seem functional).  Sometimes (maybe when I click too fast or too often) the ONLOAD event isn't called.  In fact it seems completely turned off and non-functional.  Why does this happen and is there anything I can do to prevent this?

Thank you VERY much.
0
Comment
Question by:mirror
  • 2
4 Comments
 
LVL 8

Expert Comment

by:jbirk
ID: 1267541
Well, I'm not sure about onLoad with images because I haven't really played with that yet, but I might be able to help you with the animated gif part.  Could you post the trouble code on the web and post the url for it here?  That way I could look directly at it to figure out what's going on (it sounds kind of complicated and will be easier when seeing the actual code and graphics).
-Josh
0
 

Accepted Solution

by:
Visible_Man earned 50 total points
ID: 1267542
I've have an animating gif porgram that I use that works quite well at animated multiple images.  The program store all the images and coding info in the gif so after you made the  gif all you to do is put it up like a normal picture. It's really easy to use.  Goto the web page, read through it, and get the shareware version.

http://www.mindworkshop.com/alchemy/gifcon.html

Hope you like it :)
0
 
LVL 8

Expert Comment

by:jbirk
ID: 1267543
mirror, you there?
I know how to make animated gifs play when they aren't looping now.  There are two ways.  One, you load them into image objects at pixel dimensions slightly off the dimensions you specified for the original image which is getting replaced.  When you do this, it has to resize the image every time and therefor refreshes it and starts playing it back at the beginning.

The other way is to change:
document[grfx].src="p/anim.gif"
to:
document[grfx].src="p/anim.gif#"
I know it sounds wierd but it works!

Try these out and see if they will help you.
-Josh
0
 
LVL 14

Expert Comment

by:ThG
ID: 11330304
> document[grfx].src="p/anim.gif#"
> I know it sounds wierd but it works!

jbirk, I can't believe this, it really WORKS!

I had an animated GIF to start onmouseover, and I had it preloaded in a imgs javascript array.
When the event triggers, I replace target_img.src with imgs[n].src
With jbirk's fix now I can do:
target_img.src = imgs[n].src + '#';
...and it restarts the gif animation! This was tested on IE 5 and Mozilla 1.6

Thank you.

ThG
EE Page Editor, PHP channel
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP: Filling Out/Creating a PDF 29 94
Coding for the first time 9 62
Duplicate Elements with JS / jQuery 3 24
[form-control] Retain values after a POST action 21 32
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question