Skip to content

Commit

Permalink
added preventDefault
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil888-m committed Dec 11, 2024
1 parent 57dc1a8 commit 8d2da79
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/big-picture-popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ document.addEventListener('click', (e) => {
const currentPicture = e.target.closest('.picture');

if (currentPicture) {
e.preventDefault();
openBigPhotoPopup(currentPicture.dataset.photoId);
}
});

0 comments on commit 8d2da79

Please sign in to comment.