-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from ViktorSvertoka/headernew
- Loading branch information
Showing
3 changed files
with
102 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,53 @@ | ||
// const logo = document.getElementById('logo'); | ||
// const toggleButtons = document.getElementById('toggleButtons'); | ||
// const burgerMenu = document.getElementById('burgerMenu'); | ||
// const socialMedia = document.getElementById('socialMedia'); | ||
// const openHomeButton = document.getElementById('homeButton'); | ||
// const openFavoritesButton = document.getElementById('favoritesButton'); | ||
// const modal = document.getElementById('myModal'); | ||
// const closeModal = document.getElementById('closeModal'); | ||
// const modalContent = document.getElementById('modalContent'); | ||
|
||
// function openMobileMenu() { | ||
// showModal(); | ||
// } | ||
|
||
// function closeMobileMenu() { | ||
// closeModal(); | ||
// } | ||
|
||
// function toggleButtonsFunction() { | ||
// if (!openHomeButton.classList.contains('active')) { | ||
// openHomeButton.classList.add('active'); | ||
// openFavoritesButton.classList.remove('active'); | ||
// openMobileMenu(); | ||
// redirectToHome(); | ||
// } else { | ||
// openHomeButton.classList.remove('active'); | ||
// openFavoritesButton.classList.add('active'); | ||
// openMobileMenu(); | ||
// redirectToFavorites(); | ||
// } | ||
// } | ||
|
||
// function redirectToHome() { | ||
// window.location.href = '../partials/02-hero.html'; | ||
// } | ||
|
||
// function redirectToFavorites() { | ||
// window.location.href = '../partials/10-favorites.html'; | ||
// } | ||
|
||
// function showModal() { | ||
// modalContent.innerHTML = '<p>Content for Home or Favorite goes here.</p>'; | ||
// modal.style.display = 'block'; | ||
// } | ||
|
||
// function closeModal() { | ||
// modal.style.display = 'none'; | ||
// } | ||
|
||
// toggleButtons.addEventListener('click', toggleButtonsFunction); | ||
// burgerMenu.addEventListener('click', openMobileMenu); | ||
// closeModal.addEventListener('click', closeMobileMenu); | ||
|
||
// openHomeButton.addEventListener('click', () => { | ||
// openMobileMenu(); | ||
// redirectToHome(); | ||
// }); | ||
|
||
// openFavoritesButton.addEventListener('click', () => { | ||
// openMobileMenu(); | ||
// redirectToFavorites(); | ||
// }); | ||
|
||
// toggleButtons.addEventListener('click', function () { | ||
// console.log('Toggle buttons clicked'); | ||
// toggleButtonsFunction(); | ||
// }); | ||
|
||
// burgerMenu.addEventListener('click', function () { | ||
// console.log('Burger menu clicked'); | ||
// openMobileMenu(); | ||
// }); | ||
|
||
// closeModal.addEventListener('click', function () { | ||
// console.log('Close modal clicked'); | ||
// closeMobileMenu(); | ||
// }); | ||
|
||
// openHomeButton.addEventListener('click', function () { | ||
// console.log('Open home button clicked'); | ||
// openMobileMenu(); | ||
// redirectToHome(); | ||
// }); | ||
|
||
// openFavoritesButton.addEventListener('click', function () { | ||
// console.log('Open favorites button clicked'); | ||
// openMobileMenu(); | ||
// redirectToFavorites(); | ||
// }); | ||
const burgerMenu = document.getElementById('burgerMenu'); | ||
const modalOverlay = document.getElementById('modalOverlay'); | ||
const closeModalButton = document.getElementById('closeModal'); | ||
const openHomeButton = document.getElementById('homeButton'); | ||
const openFavoritesButton = document.getElementById('favoritesButton'); | ||
|
||
burgerMenu.addEventListener('click', toggleMobileMenu); | ||
|
||
closeModalButton.addEventListener('click', closeModal); | ||
|
||
openHomeButton.addEventListener('click', () => { | ||
toggleButtonsFunction(); | ||
redirectToHome(); | ||
}); | ||
|
||
openFavoritesButton.addEventListener('click', () => { | ||
toggleButtonsFunction(); | ||
redirectToFavorites(); | ||
}); | ||
|
||
function toggleMobileMenu() { | ||
if (modalOverlay.style.display === 'block') { | ||
closeModal(); | ||
} else { | ||
openModal(); | ||
} | ||
} | ||
|
||
function openModal() { | ||
modalOverlay.style.display = 'block'; | ||
} | ||
|
||
function closeModal() { | ||
modalOverlay.style.display = 'none'; | ||
} | ||
|
||
function toggleButtonsFunction() { | ||
if (!openHomeButton.classList.contains('active')) { | ||
openHomeButton.classList.add('active'); | ||
openFavoritesButton.classList.remove('active'); | ||
} else { | ||
openHomeButton.classList.remove('active'); | ||
openFavoritesButton.classList.add('active'); | ||
} | ||
} | ||
|
||
function redirectToHome() { | ||
window.location.href = '../partials/10-favorites.html'; | ||
} | ||
|
||
function redirectToFavorites() { | ||
window.location.href = '../partials/10-favorites.html'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters