Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q718 How can one tell when an animation has finished running?

irt.org | Knowledge Base | JavaScript | Image | Q718 [ previous next ]

Q718 How can one tell when an animation has finished running?

If its an animated gif, then it might be possible. IIRC one browser triggers an onLoad event for the image for every image "frame" loaded. You could trap the onLoad event using the onLoad event handler, count them and work out when the image has finished animating:

<SCRIPT LANGUAGE="JavaScript"><!--
var myCount = 0;
var maxCount = 10;

function counter() {
    myCount++;
    if (myCount > maxCount)
        alert('Finished');
}
//-->

<IMG SRC="animated.gif" onLoad="counter()" WIDTH="100" HEIGHT="100">

Feedback on 'Q718 How can one tell when an animation has finished running?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.