Random GIF with play on mouse over function

blueheaven

Newbie
Joined
Jun 5, 2013
Messages
11
Reaction score
0
Hey everybody! I am quite new to programming and I am having a problem. I am using a script shown below which loads random GIF every time you enter the site. But I want that my GIF would only start to animate on mouse hover. Is that possible with the random GIF script I am using? Thanks in advance.

SCRIPT: pastebin.com/N39fDMRH
 
Last edited:
Yes, it is possible. But there is no way to control a gif, so you'll need two files for every gif, one animated and one that only displays whatever you want to have displayed (e.g. first frame of the gif).
Then add an event handler for mouseover that changes the img src to the animated version and, if you want to stop it again, an event handler for mouseout that changes the img src back to the static version.
 
Back
Top