Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
63 lines (55 loc) · 1.91 KB
/
Copy pathscript.js
File metadata and controls
63 lines (55 loc) · 1.91 KB
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
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
document.getElementById("myOverlay").style.display = "none";
}
// Close the dropdown if the user clicks outside of it
// window.onclick = function(event) {
// console.log("test");
// if (!event.target.matches('.dropbtn')) {
// var dropdowns = document.getElementsByClassName("mobileSubMenu");
// var i;
// for (i = 0; i < dropdowns.length; i++) {
// var openDropdown = dropdowns[i];
// if (openDropdown.classList.contains('show')) {
// openDropdown.classList.remove('show');
// }
// }
// }
// }
// CODICE JAVASCRIPT PER ANIMAZIONE TOGGLE
const header = document.getElementById("mobileNav");
const toggle = document.getElementById("toggle");
const navbar = document.getElementById("mobileNavBar");
const subMenuMobile = document.getElementById("myDropdown");
const searchB = document.getElementById("searchButton");
document.onclick = function (e) {
if (
e.target.id !== "header" &&
e.target.id !== "toggle" &&
e.target.id !== "navbar"
) {
toggle.classList.remove("active");
navbar.classList.remove("active");
}
};
toggle.onclick = function () {
toggle.classList.toggle("active");
navbar.classList.toggle("active");
};
// FULL SCREEN SEARCH BOX
function openSearch() {
document.getElementById("myOverlay").style.display = "block";
subMenuMobile.classList.remove("show");
}
function closeSearch() {
document.getElementById("myOverlay").style.display = "none";
}
// BLACK SCREEN
function openBlack() {
document.getElementById("blackScreen").style.visibility = "visible";
}
function closeBlack() {
document.getElementById("blackScreen").style.visibility = "hidden";
}