Welcome to WebmasterWorld Guest from 23.20.137.66

Forum Moderators: open

Message Too Old, No Replies

Rollover Animated GIF Problem

onMouseover/out won't animate in Mozilla

     
6:42 am on Dec 14, 2004 (gmt 0)

10+ Year Member



I've got a simple image rollover code (images pre-loaded) using animated gifs (one run, no loop). Works a-okay in IE, but my Mozilla won't run the animation. It just goes straight to the final frame of the image.

Why does Mozilla do this, and what can I do to correct it?

12:42 pm on Dec 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So far, it's anybody's guess ;)
10:53 pm on Dec 14, 2004 (gmt 0)

10+ Year Member



Could it be because of the pre-loading? If the image only loops once, and it's pre-loaded, maybe the browsers thinks it's already played? That's my best guess...
12:44 am on Dec 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's what has happened with Netscape/Mozilla browsers since day one ... they play the loop while in the cache, so when they're called by the mouseover, you're looking at either the final frame or whatever frame the animation is currently at when called.

Dunno why they haven't modified the browser code since Netscape v.1 ... I guess they have their reasons.

Depending on the number of frames, you might consider loading the individual frames with a setInterval() for timing control to show the animation for Moz users. I assume the animation's pretty short. It's a crappy workaround ... but it does the job.

12:26 am on Dec 16, 2004 (gmt 0)

10+ Year Member



What may work is to reload the image onmouseover, something like

<A Href="#" onmouseover="document.myimage1.src='Animated1.gif';">
<img src="whatever.gif" name=myimage1>
</A>

8:22 am on Dec 17, 2004 (gmt 0)

10+ Year Member



HocusPocus's suggestion didn't make a difference. It worked the same as before; that is, it worked in all my browsers except Mozilla. (Which means it also worked it FireFox, but not Mozilla -- go figure!)

I haven't tried the StupidScript's suggestion of setInterval() for my individual frames yet. (Yes, that will be a tedious, time-consuming pain...)

2:01 pm on Dec 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You might try a slight variation on HP's suggestion, where you load another URL before reloading the animated image. Even just an empty string for the src value might do the trick.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month