From 329f1371a9ef8c9cb480a0e9464513ac4efdb6b2 Mon Sep 17 00:00:00 2001 From: Viktor Svertoka <115661003+ViktorSvertoka@users.noreply.github.com> Date: Sat, 20 Jan 2024 15:55:17 +0200 Subject: [PATCH] Update 01-mobile-menu.js --- src/js/01-mobile-menu.js | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/js/01-mobile-menu.js b/src/js/01-mobile-menu.js index 02b07ae..e824d06 100644 --- a/src/js/01-mobile-menu.js +++ b/src/js/01-mobile-menu.js @@ -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'); @@ -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); } @@ -110,7 +85,6 @@ const handleClick = event => { event.preventDefault(); } - // Убираем класс "active" с кнопки Home при переходе на favorites.html if (event.currentTarget === favoritesButton) { homeButton.classList.remove('active'); }