I am using Javascript and there is an image on my site that becomes larger when clicked on. I need an if statement that makes it smaller again when it’s clicked on again.
I am using HTML, CSS and Javascript.
0)Image is small 1)Image becomes large when clicked on 2)Image becomes smaller if clicked on again
I am having trouble with #2.
Here is my code:
if (thumbnailElement.className == "")
{
thumbnailElement.addEventListener("click", function()
{
thumbnailElement.className = "small"; });
}
else {
thumbnail.Element.className=="";
}

Aucun commentaire:
Enregistrer un commentaire