GtiClicker
GtiClicker

Reputation: 78

Why doesn't a image change to a gif correctly with javascript?

I am making a game with a car that turns into an explosion when you click it. (Check it out at https://clickersandbeyond.com); I have tested the explosion in html and it works just fine, but when you click the car it changes to the gif correctly but it is stopped at a single frame.

Any help would be appreciated and here is my code

if(carClicks == 1){
    document.getElementById("image").src = "../Images/explosion.gif";
}

Upvotes: 0

Views: 111

Answers (1)

CodeNinja
CodeNinja

Reputation: 626

The link isn't changing the car image for me, but gifs do display in img tags. See below for a very simple example:

 document.getElementById("image").src = "https://i.sstatic.net/SBv4T.gif";
<img id="image"/>

I would try a different image to see if that changes anything.

Upvotes: 1

Related Questions