forked from space192/PiscineWeb22
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
54 lines (42 loc) · 1.06 KB
/
index.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
//#region dark theme
let darktheme = 0;
//https://www.w3schools.com/js/js_cookies.asp
function toggleRootClass() {
document.querySelector(":root").classList.toggle("dark");
}
if(localStorage.getItem("theme") === "ui")
{
var element = document.querySelector(":root");
element.classList.add("dark");
}
function switchTheme() {
var element = document.querySelector(":root");
element.classList.toggle("dark");
if(element.classList.contains("dark"))
{
localStorage.setItem("theme","ui");
}
else
{
localStorage.setItem("theme","");
}
}
//#endregion
//#region menu deroulant
//https://www.w3schools.com/howto/howto_js_dropdown.asp
function menuDeroulant() {
document.getElementById("Options").classList.toggle("show");
}
window.onclick = function (event) {
if (!event.target.matches('.boutounDeroulant')) {
var deroulant = document.getElementsByClassName("contenu");
let i;
for (i = 0; i < deroulant.length; i++) {
var ouverture = deroulant[i];
if (ouverture.classList.contains('show')) {
ouverture.classList.remove('show');
}
}
}
}
//#endregion