-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
63 lines (52 loc) · 1.85 KB
/
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
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
const primaryHeader = document.querySelector('.primary-header');
const navToggle = document.querySelector(".mobile-nav-toggle");
const primaryNav = document.querySelector(".primary-nav");
const disablescrolldiv = document.querySelector(".body");
const disablescrollbody = document.body;
navToggle.addEventListener("click", () => {
primaryNav.hasAttribute("data-visible")
? navToggle.removeAttribute("aria-expanded", true)
: navToggle.setAttribute("aria-expanded", false);
primaryNav.toggleAttribute("data-visible");
primaryHeader.toggleAttribute("data-overlay");
disablescrolldiv.classList.toggle("disableoverflow");
disablescrollbody.classList.toggle("disableoverflow");
});
let isdarkmodeon = localStorage.getItem("Darkmodechoice");
let lang = localStorage.getItem("lang");
function darking_mode() {
var element = document.body;
element.classList.toggle("dark-mode");
var element2 = document.querySelector(".icon-hamburger");
element2.classList.toggle("svg-dark");
localStorage.setItem("Darkmodechoice", isdarkmodeon.toString());
};
window.onload = function () {
let isdarkmodeon = localStorage.getItem("Darkmodechoice");
let lang = localStorage.getItem("lang");
if (isdarkmodeon == 1) {
darking_mode();
}
/* if (lang == 1) {
document.documentElement.setAttribute("lang", "it");
}
else {
document.documentElement.setAttribute("lang", "en");
} */
};
document.getElementById("dark-mode-button").addEventListener("click",() => {
document.body.classList.contains("dark-mode")
? isdarkmodeon = 0
: isdarkmodeon = 1;
darking_mode();
});
/* lang = document.querySelector('.messageCheckbox:checked');
console.log(lang);
function langchange(){
localStorage.setItem("lang", lang.toString());
}
document.getElementById('button-16').addEventListener('focus', () => {
langchange();
}); */
//*maps dark mode
// coookies