Coding task · JavaScript and TypeScript course · Module 8: Events and the DOM

Exercise: Image Gallery

Create an interactive dinosaur photo gallery with zoom.

Task

The index.html file has a #gallery with three thumbnails (the data-full attribute points to the large version) and a hidden #lightbox (style.css shows it with the open class). Fill in the blanks in the script: ___BLANK1___ is the click event, and ___BLANK2___ is the event property that points to the element that was clicked (we check whether it is an IMG). Clicking a photo should open the lightbox with the large version of that photo and the caption from alt, and clicking the gap between photos must not open it.