-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.js
94 lines (80 loc) · 2.75 KB
/
menu.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const barsMenuBtn = document.querySelector('.fa-bars');
const closeMenuBtn = document.querySelector('.fa-xmark');
const fullMenu = document.querySelector('.full-menu');
const menuItems = document.querySelector('.menuItems');
const creditsDiv = document.querySelector('.credits');
const menuInfo = document.querySelector('.menu-display-info');
const calcBtn = document.querySelector('.calc');
const calcBdy = document.querySelector('.calculator');
const tempBtn = document.querySelector('.temp');
const tempBdy = document.querySelector('.temp-convert');
const currencyBtn = document.querySelector('.curr');
const currencyBdy = document.querySelector('.curr-convert');
const openMenu = ()=>{
barsMenuBtn.classList.toggle('rotate')
setTimeout(()=>{
barsMenuBtn.classList.toggle('hide')
barsMenuBtn.classList.toggle('rotate')
}, 700)
setTimeout(()=>{
closeMenuBtn.classList.toggle('hide')
}, 700)
setTimeout(()=>{
fullMenu.classList.toggle('side-roll')
}, 400)
setTimeout(()=>{
creditsDiv.classList.toggle('hide');
menuItems.classList.toggle('hide');
}, 1000)
}
const closeMenu = ()=>{
closeMenuBtn.classList.toggle('rotate')
setTimeout(()=>{
closeMenuBtn.classList.toggle('hide')
}, 700)
setTimeout(()=>{
barsMenuBtn.classList.toggle('hide')
}, 700)
setTimeout(()=>{
fullMenu.classList.toggle('side-roll')
}, 300)
setTimeout(()=>{
creditsDiv.classList.toggle('hide');
menuItems.classList.toggle('hide');
}, 400)
}
barsMenuBtn.addEventListener('click', openMenu)
closeMenuBtn.addEventListener('click', closeMenu)
calcBtn.addEventListener('click', () =>{
menuInfo.textContent = "Calculator";
calcBtn.classList.add('choosen');
tempBtn.classList.remove('choosen');
currencyBtn.classList.remove('choosen');
calcBdy.classList.remove('hide');
calcBdy.classList.add('show');
currencyBdy.classList.add('hide');
currencyBdy.classList.remove('show');
tempBdy.classList.add('hide')
tempBdy.classList.remove('show');
closeMenu();
})
tempBtn.addEventListener('click', () =>{
menuInfo.textContent = "Temperature";
tempBtn.classList.add('choosen');
calcBtn.classList.remove('choosen');
currencyBtn.classList.remove('choosen');
tempBdy.classList.remove('hide');
currencyBdy.classList.add('hide');
calcBdy.classList.add('hide')
closeMenu();
})
currencyBtn.addEventListener('click', () =>{
menuInfo.textContent = "Currency";
currencyBtn.classList.add('choosen');
calcBtn.classList.remove('choosen');
tempBtn.classList.remove('choosen');
currencyBdy.classList.remove('hide');
tempBdy.classList.add('hide');
calcBdy.classList.add('hide')
closeMenu();
})