homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Rollover Animated GIF Problem
onMouseover/out won't animate in Mozilla
Horse Feathers

 6:42 am on Dec 14, 2004 (gmt 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?


Bernard Marx

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

So far, it's anybody's guess ;)


 10:53 pm on Dec 14, 2004 (gmt 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)

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)

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>

Horse Feathers

 8:22 am on Dec 17, 2004 (gmt 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...)

Rambo Tribble

 2:01 pm on Dec 17, 2004 (gmt 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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved