Background image not changing with weather

Hello guys,

I’m working for a project with js where I have to create a weather app. I’d like to change the background image by changing the weather but my code still doesn’t work.
Here is the code https://codepen.io/ileniacont/pen/yLJvQaN

Thanks in advance!

1 Like

Hey @Ileniacont. I don’t know whether this is the problem, but all your images look the same. When I put the images/thunderstorm.jpg as the default bg image in CSS, nothing changes! So, are all the images you have the same?
Apologies if this is wrong.

I’ve just tried doing it in my code on atom and it works, so it’s not a problem with images :slight_smile: I’m doing something wrong in js, I’m pretty sure

1 Like

Maybe the image url is wrong? You need to host your images and get a live link. Then only images will work in CodePen.

Looks like the image url you specified will only work in your computer as it’s stored in your computer only.

Yea true, but from my computer as well the code won’t get executed the way I want and it’s not for the images path :frowning:

1 Like

When I ran the CodePen JS Analyzer, I found that a few lines of code are missing a semicolon ;. Is that why?
You can run the analyzer by clicking on the down arrow in the JS code box and then clicking on Analyze JS.