Skip to content

Commit

Permalink
val 4
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelUd committed Nov 24, 2023
1 parent 030c46b commit ce89371
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions js/fullsize-images-render.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ const createCommentsBlock = (comments) =>{
commentsBlock.insertAdjacentHTML('afterbegin', comments.map((comment) => createComment(comment.avatar, comment.name, comment.message)).join('')); // Array(comments).map
};

function hideModal () {
document.body.classList.remove('modal-open');
bigPicture.classList.add('hidden');
}

const onDocumentKeydown = (evt) => {
if (evt.key === 'Escape') {
hideModal();
Expand All @@ -36,6 +31,14 @@ const onCloseButtonClick = () => {
hideModal();
};

function hideModal () {
document.body.classList.remove('modal-open');
bigPicture.classList.add('hidden');
closeButton.removeEventListener('click', onCloseButtonClick);
document.removeEventListener('keydown', onDocumentKeydown);

}

const constructBigPicture = (picture, photoInfo, image) =>{
bigImage.src = image.src;
const likes = picture.querySelector('.picture__likes');
Expand Down

0 comments on commit ce89371

Please sign in to comment.