Skip to content

Commit

Permalink
изменения
Browse files Browse the repository at this point in the history
  • Loading branch information
MaksimRozov committed Mar 9, 2024
1 parent bacc013 commit 83fac7d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions js/showLargePicture/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const bigPictureBlock = document.querySelector('.big-picture');
const pictureList = document.querySelector('.pictures');
const bigPictureCancel = document.querySelector('.big-picture__cancel');

//функция закрытия

const onCloseBigPicture = () => {
bigPictureBlock.classList.add('hidden');
bigPictureCancel.removeEventListener('click', onCloseBigPicture);
};

const onOpenBigPicture = (evt) => {
evt.preventDefault();

if(evt.target.closest('.picture')){
bigPictureBlock.classList.remove('hidden');
bigPictureCancel.addEventListener('click', onCloseBigPicture);
}
};


pictureList.addEventListener('click', onOpenBigPicture);

0 comments on commit 83fac7d

Please sign in to comment.