PDA

View Full Version : detecting animations


paulstreats
08-17-2003, 11:38 PM
Does anybody know wether it is possible to detect wether a gif animation has finished playing or is still playing?

glenngv
08-18-2003, 06:11 AM
I think animated gifs always trigger the image onload event whenever the animation starts.

try this simple test:

<img src="animated.gif" onload="window.status++">

observe the status bar and see if the number increments whenever the animation starts.

With that behavior, you can do something like this:

var loopFlag = false;
function checkStatus(){
if (loopFlag){
//do something
}
loopFlag = true;
}
...
<img src="animated.gif" onload="checkStatus()">