diff --git a/js/big-picture-popup.js b/js/big-picture-popup.js index 4a7ecbf..c73149e 100644 --- a/js/big-picture-popup.js +++ b/js/big-picture-popup.js @@ -37,7 +37,8 @@ function renderComments(photoId) { return commentFragmentList; } -function hidePhotoPopup() { +function hidePhotoPopup(e) { + e.preventDefault(); hide(bigPhotoPopup); document.removeEventListener('keydown', onEscapeKeydown); document.body.classList.remove('modal-open'); diff --git a/js/main.js b/js/main.js index e4a7d92..859be33 100644 --- a/js/main.js +++ b/js/main.js @@ -7,6 +7,7 @@ document.addEventListener('click', (e) => { const currentPicture = e.target.closest('.picture'); if (currentPicture) { + e.preventDefault(); openBigPhotoPopup(currentPicture.dataset.photoId); } });