work.suroh.tk/js/menu.js

46 lines
1.2 KiB
JavaScript
Executable File

// GET ELEMENTS TO INTERACT WITH
// main menu
let audioBut = document.getElementById('audioButton')
let otherBut = document.getElementById('otherButton')
// GET DOMs TO ALTER
let audioSection = document.getElementById('audioSection')
let otherSection = document.getElementById('otherSection')
// MAIN MENU
audioBut.addEventListener("click", () => {
if (audioSection) {
otherSection.style.visibility = "hidden"
otherSection.style.display = "none"
audioSection.style.visibility = "visible"
audioSection.style.display = "inherit"
} else {
console.log('No section')
}
})
otherBut.addEventListener("click", () => {
if (otherSection) {
audioSection.style.visibility = "hidden"
audioSection.style.display = "none"
otherSection.style.visibility = "visible"
otherSection.style.display = "inherit"
} else {
console.log('No section')
}
})
// MOBILE menu
var menuButton = document.querySelector("#mobileButt");
menuButton.addEventListener("click", function(event) {
event.preventDefault();
var parent = document.querySelector(".navigation");
if (parent.classList.contains("open")) {
parent.classList.remove("open");
} else {
parent.classList.add("open");
}
});