-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
30 lines (27 loc) · 959 Bytes
/
scripts.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
const toggleSwitch = document.querySelector('.onoffswitch-checkbox');
function switchTheme(e) {
if (e.target.checked) {
document.documentElement.setAttribute('theme', 'light');
}
else {
document.documentElement.setAttribute('theme', 'dark');
}
adjustLinks(e);
}
toggleSwitch.addEventListener('change', switchTheme, false);
function adjustLinks(e){
link1 = document.querySelector(".link1");
link2 = document.querySelector(".link2");
if (e.target.checked){
link1.innerHTML = "code";
link1.setAttribute("href", "https://github.com/taanguyen");
link2.innerHTML = "blog";
link2.setAttribute("href","https://taanguyen.github.io/blog/");
}
else{
link1.innerHTML = "read";
link1.setAttribute("href", "#");
link2.innerHTML = "compose music";
link2.setAttribute("href","https://youtu.be/jyZd-84vZ_w");
}
}