Why is my if statement not working?

https://codepen.io/TuscannyCodes/pen/NWdboRL

Why isn’t my final if statement working in the Javascript? Everything looks fine to me. I want it so that if a class containing a bacground color of blue is active on the body. Then remove a hidden visibility class on a photo div.

I linked the codepen above but here is the if statement as well below


if (body.classList.contains("colorSwap")) {

	photo.classList.remove("notVisible");
};

It isn’t inside the a function called by the event listener, so that code doesn’t run when you click the page.

1 Like

Hahaha oops! Thank you so much lol. I figured it would work outside of the event :sweat_smile:

Thanks for your edit on the post as well :pray:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.