-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenudropdown.js
45 lines (39 loc) · 1.27 KB
/
menudropdown.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
function myFunction1() {
document.getElementById("myDropdown1").classList.toggle("show");
}
function myFunction2() {
document.getElementById("myDropdown2").classList.toggle("show");
}
function myFunction3() {
document.getElementById("myDropdown3").classList.toggle("show");
}
function myFunction4() {
document.getElementById("myDropdown4").classList.toggle("show");
}
function myFunction5() {
document.getElementById("myDropdown5").classList.toggle("show");
}
window.onclick = function (event) {
if (!event.target.matches('#dropbtn1')) {
let dpd = document.getElementsByClassName("dropdown-content");
let i;
for (i = 0; i < dpd.length; i++) {
let openDropdown = dpd[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
window.onclick = function (event) {
if (!event.target.matches('#dropbtn2')) {
let dropdowns2 = document.getElementsByClassName("dropdown-content");
let j;
for (j = 0; j < dropdowns.length; j++) {
let openDropdown = dropdowns2[j];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}