Welcome to WebmasterWorld Guest from 54.196.244.186

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)

New User

10+ Year Member

joined:Mar 1, 2004
posts:22
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 15, 2004
posts:2047
votes: 0


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

Preferred Member

10+ Year Member

joined:Sept 4, 2002
posts:508
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 20, 2004
posts:1475
votes: 0


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)

Junior Member

10+ Year Member

joined:Dec 27, 2002
posts:125
votes: 0


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)

New User

10+ Year Member

joined:Mar 1, 2004
posts:22
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 14, 2004
posts:1181
votes: 0


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.