-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
103 lines (87 loc) · 3.01 KB
/
script.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
function toggleMode() {
const html = document.documentElement;
html.classList.toggle("space");
const img = document.querySelector("#profile img");
if (html.classList.contains("space")) {
img.setAttribute("src", "./assets/avatar-space.png");
img.setAttribute("alt", "profile");
}
else {
img.setAttribute("src", "./assets/avatar.png");
img.setAttribute("alt", "profile");
}
const hero = document.querySelector("#hero-bg img");
if (html.classList.contains("space")) {
hero.setAttribute("src", "./assets/hero-bg.svg");
hero.setAttribute("alt", "Flying Astrounaut Animation");
}
else {
hero.removeAttribute("src", "./assets/hero-bg.svg");
hero.removeAttribute("alt", "Flying Astrounaut Animation");
}
const pdf = document.querySelector("#pdf img");
if (html.classList.contains("space")) {
pdf.setAttribute("src", "./assets/pdf-icon-space.svg");
pdf.setAttribute("alt", "PDF Icon");
}
else {
pdf.setAttribute("src", "./assets/pdf-icon.svg");
pdf.setAttribute("alt", "PDF Icon");
}
const html5css3 = document.querySelector("#html5css3 img");
if (html.classList.contains("space")) {
html5css3.setAttribute("src", "./assets/html5&css3-icon-space.svg");
html5css3.setAttribute("alt", "HTML5 & CSS3 Icon");
}
else {
html5css3.setAttribute("src", "./assets/html5&css3-icon.svg");
html5css3.setAttribute("alt", "HTML5 & CSS3 Icon");
}
const react = document.querySelector("#react img");
if (html.classList.contains("space")) {
react.setAttribute("src", "./assets/react-icon-space.svg");
react.setAttribute("alt", "React Icon");
}
else {
react.setAttribute("src", "./assets/react-icon.svg");
react.setAttribute("alt", "React Icon");
}
const notion = document.querySelector("#notion img");
if (html.classList.contains("space")) {
notion.setAttribute("src", "./assets/notion-icon-space.svg");
notion.setAttribute("alt", "Notion Icon");
}
else {
notion.setAttribute("src", "./assets/notion-icon.svg");
notion.setAttribute("alt", "Notion Icon");
}
}
/* HTML5 Icon & CSS3 Icon
const html5 = document.querySelector("#html5");
if (html.classList.contains("space")) {
html5.setAttribute("src", "./assets/html5-icon-space.svg");
html5.setAttribute("alt", "HTML5 Icon");
}
else {
html5.setAttribute("src", "./assets/html5-icon.svg");
html5.setAttribute("alt", "HTML5 Icon");
}
const css3 = document.querySelector("#css3");
if (html.classList.contains("space")) {
css3.setAttribute("src", "./assets/css3-icon-space.svg");
css3.setAttribute("alt", "CSS3 Icon");
}
else {
css3.setAttribute("src", "./assets/css3-icon.svg");
css3.setAttribute("alt", "CSS3 Icon");
}
Hero Image Animation
const frameHeight = 102;
const frames = 15;
const div = document.getElementById("hero-bg").children;
let frame = 0;
setInterval(function () {
const frameOffset = (++frame % frames) * -frameHeight;
div.style.backgroundPosition = "0px " + frameOffset + "px";
}, 100);
*/