@Alex-Archer-I
Posted
Hi!
To fix your background issue you can use those rules:
body {
background-image: url("../assets/images/background-pattern-desktop.svg");
background-size: contain;
background-repeat: no-repeat;
}
Also I can suggest you a little improvement for your code. You can use for-of
to iterate through array of elements which a bit easier. Like this:
for (const element of questions) {
plus[i].addEventListener("click", () => {
plus[i].classList.toggle("hidden")
minus[i].classList.toggle("hidden")
answers[i].classList.toggle("hidden")
})
}
And you can declare separate function and pass it as callback in addeventListener
. It will make a code leaner and it's considered a good practice - to not repeat code.
Hope it'll help. Happy coding =)