How can I make an image display on the screen for 2 seconds and it switches back to the first screen? | SoloLearn: Learn to code for FREE!

+1

How can I make an image display on the screen for 2 seconds and it switches back to the first screen?

https://code.sololearn.com/WXWPivr4755n/?ref=app

how

9 Answers

New Answer

+5

//Use the setTimeout function: setTimeout (function (){ document.querySelector("#dogGif").remove(); }, 2000);

+3

I see the game, the problem here is that you are changing the src attribute of image stored on "unhatchedEgg", so you need to put the url that you have before to switch the image. But this is a problem too because every time that you change src, images are reloaded The bes way to resolve this is loading all the images before and then you can use it without having to load again

+3

Ok, give me a few minutes

+2

+2

πŸ˜„ it's because my English or how to make the code?

+1

0

0

0