Interactive online courses HTML Academy
2026-03-09 10:46 Diff

Meow! You did a good job, but this is no time to take a break!

We need to program a gallery with my photos for the website of our web design studio. Our customers need to know our heroic web developer in person!

The gallery consists of several thumbnails (elements with the gallery__photo-preview class) and a large photo (full-photo class) When you click on a thumbnail, it should change to a large image. The large image should correspond to the preview that the user clicked on.

The image data is collected in the photos array. Each element in the array is a path to the full-size photo. The order of the elements in this array is the same as the order of the thumbnails in the markup.

The web designer has already prepared everything: there are preview images inside buttons with the gallery__photo-preview class, and when users click on these buttons, they will change the contents of the large image (full-photo class). As is typical of these assignments, we have been asked to program the user interface interaction.

First, find all of the thumbnails using querySelectorAll as well as the large image using querySelector, and then write the elements that have been found to variables.

We have already learned about querySelectorAll in this assignment as well as in this one from the “Getting to Know JavaScript in Your Browser” chapter. Take a look there if you have forgotten how this method works.