diff --git a/src/scripts/main.js b/src/scripts/main.js index ad9a93a7..1c5b21f5 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1 +1,13 @@ 'use strict'; + +const thumbs = document.getElementById('thumbs'); +const mainImg = document.getElementById('largeImg') + +thumbs.addEventListener('click', (e) => { + const link = e.target.closest('.list-item__link') + if (link) { + e.preventDefault() + mainImg.src = link.href + } +}); +