-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
108 lines (92 loc) · 2.38 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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Variables
const qNo = document.getElementById('q-no');
const question = document.getElementById('question');
const menubtn = document.getElementById('menubtn');
const pos = document.getElementById('pos');
const back = document.getElementById('back');
const next = document.getElementById('next');
const body = document.querySelector('body');
function themeSwitch(e){
if (e == 0) {
body.classList.add("light");
body.classList.remove("dark");
}
else {
body.classList.add("dark");
body.classList.remove("light");
}
}
let themeOpen = false;
let menuOpen = false;
const theme = document.getElementById('theme');
const dd1 = document.getElementsByClassName('dropdown');
const dd2 = document.getElementById('dropdown2');
function dd(close) {
themeOpen = !(themeOpen) && close;
console.log(themeOpen);
if (themeOpen) {
dd2.style.height = "90px";
dd2.style.pointerEvents = "auto";
}
else {
dd2.style.height = "0px";
dd2.style.pointerEvents = "none";
}
}
function mo(close) {
// body...
menuOpen = !(menuOpen) && close;
console.log(menuOpen);
if (menuOpen) {
dd1[0].style.opacity = "1";
dd1[0].style.pointerEvents = "auto"
}
else {
dd1[0].style.opacity = "0";
dd1[0].style.pointerEvents = "none";
}
}
let a = -1;
let prea = 1;
let test = ["What's my full name", "55", "3Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sed aliquam nulla.modo sedsapien vitae, interdum tristique massa.", '4', '5', '6', '7'];
for (var i = 0; i < test.length; i++) {
let div = document.createElement("div");
div.classList = "pos-mark";
pos.appendChild(div);
}
const markers = document.getElementsByClassName("pos-mark");
questionChanger(1);
function markerChanger(a,e) {
// body...
markers[a].classList.add("curr-pos");
markers[prea].classList.remove("curr-pos");
}
function questionPicker(a) {
// body...
qNo.innerText = "Question #"+(a+1);
question.innerText = test[a];
}
function questionChanger(e) {
// body...
a += e;
if (a >= test.length) {
a = 0;
}
else if (a < 0) {
a = test.length - 1;
}
markerChanger(a,e);
questionPicker(a);
prea = a;
}
/*
menubtn.addEventListener("DOMActivate", function c(close){
dd(false)
mo(true)
});
menubtn.addEventListener("focusout", function b(close) {
dd(false)
console.log('pd');
mo(false)
});
*/