Skip to content

Commit

Permalink
Update modal-window.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KristinaHranovska committed Feb 13, 2024
1 parent fa9b43f commit b33b477
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/js/modal-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@ const galleryWindow = document.querySelector('.js-gallery');

const link = document.querySelector('.link-home');
const isActiveLink = link.getAttribute('href');
console.log(isActiveLink);
const currentPage = window.location.pathname;
const removeCards = document.querySelector('.buttons-modal');

// Якщо поточна сторінка - index.html, то показуємо блок з кнопкою
if (currentPage.includes('index.html') || isActiveLink === './index.html') {
console.log(isActiveLink);
const removeCards = document.querySelector('.buttons-modal');
if (removeCards) {
removeCards.classList.remove('visually-hidden');
}
removeCards.classList.remove('visually-hidden');
}

if (
currentPage.includes('favorites.html') ||
isActiveLink === './favorites.html'
) {
console.log(isActiveLink);
removeCards.classList.add('visually-hidden');
}
galleryWindow.addEventListener('click', openModal);

// Відкриття модалки
Expand Down

0 comments on commit b33b477

Please sign in to comment.