Animated gif stops after click

I put animated gif inside <a href> tag to open a web dialog. The gif stops its animation after the mouse click.
How can i avoid this stop?
galorAsked:
Who is Participating?
 
ahosangConnect With a Mentor Finance Systems DeveloperCommented:
You may be using something like:
<a href="javascript:yourFunction()"> which is deprecated
or :
<a href="#" onclick="yourFunction()">

The way to stop javascript from messing with animated gifs(and the best way in any case) is:
<a href="#" onclick="yourFunction();return false">
0
 
avnerCommented:
You cannot, as long as you use a modal popup the web-engine stop responding untill you come back from the modal window/popup.
0
 
galorAuthor Commented:
The problem is that it does not restart the animation after the popup window is closed.
Any suggestion?
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
COBOLdinosaurCommented:
Reload the gif when you come back from the popup.

if the image is:

<img name="thegif" src="myimage.gif">

Then document.images['thegif'].src="myimage.gif";

Should restart it.

Though you might have to actually clear it with:
document.images['thegif'].src="";
document.images['thegif'].src="myimage.gif";

There should not be a deley reloading because it will be in cache.

Cd&

0
 
galorAuthor Commented:
Very good. It is working!
0
 
ahosangFinance Systems DeveloperCommented:
Glad to help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.