-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
25 lines (21 loc) · 850 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const menus = ['me', 'weekdays', 'weekends', 'ambition', 'reachMe'];
const showMenu = (_event, menuToShow) => {
if(!menuToShow){
return;
}
// Hide other menus and make other buttons inactive
menus.forEach(menu => {
if(menu === menuToShow){
return;
}
const menuToHideElement = document.getElementById(`${menu}Menu`);
const inactiveButtonElement = document.getElementById(`${menu}Button`);
menuToHideElement.style.display = 'none';
inactiveButtonElement.className = inactiveButtonElement.className.replace(" active", "");
})
// Make selected button active
event.currentTarget.className += " active";
// Show selected menu
const menuToShowElement = document.getElementById(`${menuToShow}Menu`);
menuToShowElement.style.display = 'flex';
}