Skip to content

Commit

Permalink
Update 01-mobile-menu.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorSvertoka committed Jan 20, 2024
1 parent ef831be commit 329f137
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/js/01-mobile-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,6 @@ menuNavLinks.forEach(link => {
});
});

// Переключение кнопок-ссылок

// document.addEventListener('DOMContentLoaded', () => {
// const currentPath = window.location.pathname;

// if (currentPath.includes('index.html')) {
// const homeButton = document.getElementById('homeButton');
// homeButton.classList.add('active');
// homeButton.addEventListener('click', handleClick);
// } else if (currentPath.includes('favorites.html')) {
// const favoritesButton = document.getElementById('favoritesButton');
// favoritesButton.classList.add('active');
// favoritesButton.addEventListener('click', handleClick);
// }
// });

// const handleClick = event => {
// if (!event.currentTarget.classList.contains('active')) {
// alert('Button clicked!');
// } else {
// event.preventDefault();
// }
// };

document.addEventListener('DOMContentLoaded', () => {
const currentPath = window.location.pathname;
const homeButton = document.getElementById('homeButton');
Expand All @@ -94,7 +70,6 @@ document.addEventListener('DOMContentLoaded', () => {
favoritesButton.classList.add('active');
favoritesButton.addEventListener('click', handleClick);
} else {
// Добавляем класс "active" на кнопку Home при первой загрузке страницы
homeButton.classList.add('active');
homeButton.addEventListener('click', handleClick);
}
Expand All @@ -110,7 +85,6 @@ const handleClick = event => {
event.preventDefault();
}

// Убираем класс "active" с кнопки Home при переходе на favorites.html
if (event.currentTarget === favoritesButton) {
homeButton.classList.remove('active');
}
Expand Down

0 comments on commit 329f137

Please sign in to comment.