-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
66 lines (54 loc) · 1.19 KB
/
app.js
File metadata and controls
66 lines (54 loc) · 1.19 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
64
65
66
let theme = localStorage.getItem("theme");
if (theme == null) {
setTheme("light");
} else {
setTheme(theme);
}
let themeDots = document.getElementsByClassName("theme-dot");
for (var i = 0; themeDots.length > i; i++) {
themeDots[i].addEventListener("click", function () {
let mode = this.dataset.mode;
setTheme(mode);
});
}
function setTheme(mode) {
if (mode == "light") {
document.getElementById("theme-style").href = "styles/default.css";
}
if (mode == "blue") {
document.getElementById("theme-style").href = "styles/blue.css";
}
if (mode == "yellow") {
document.getElementById("theme-style").href = "styles/yellow.css";
}
if (mode == "purple") {
document.getElementById("theme-style").href = "styles/purple.css";
}
localStorage.setItem("theme", mode);
}
// Animations
const sr = ScrollReveal({
distance: "0px",
duration: 2500,
delay: 400,
// reset: true,
useDelay: "onload",
easing: "ease-in",
});
sr.reveal(`.post`, {
interval: 300,
origin: "bottom",
rotate: {
x: 40,
y: 40,
z: 40,
},
duration: 1000,
});
sr.reveal(`footer p`, {
origin: "top",
distance: "20px",
duration: 1000,
delay: 700,
mobile: false,
});