I am following this tutorial from W3Schools on how to build a slideshow using HTML, CSS, and Javascript. On the website I am developing, I would like the thumbnails at the bottom and the arrows on the sides to be initially hidden, until the user presses a button.
To do so, in the CSS file, I have set the visibility: hidden;
. The CSS code for the class dot
, which is the bottom thumbnail, is as follows:
.dot {
cursor: pointer;
height: 15px;
width: 15px;
margin: 0 2px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
visibility: hidden;
transition: background-color 0.6s ease;
}
In the Javascript action for the button, I have set the visibility of the document's elements under the class "dot" to visible, like so:
document.getElementsByClassName("dot").style.visibility="visible";
I have verified that this action is being triggered when the button is pressed through an alert() view. Every line of code seems to run as intended up until this command. Also, the thumbnails at the bottom (the "dot" elements) do not appear, so their visibility does not become visible as intended.
Any ideas on why this may be, or how I can fix it? Thanks a lot for your help!