-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (26 loc) · 901 Bytes
/
script.js
File metadata and controls
30 lines (26 loc) · 901 Bytes
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
function toggleTheme() {
const html = document.documentElement
/*mudar theme*/
// if (html.classList.contains("light-theme")) {
// html.classList.remove("light-theme")
// } else {
// html.classList.add("light-theme")
// }
html.classList.toggle("light-theme")
/* mudar imagem */
const img = document.querySelector("#profile img")
if (html.classList.contains("light-theme")) {
img.setAttribute("src", "./assets/avatar-light.png")
img.setAttribute(
"alt",
"Foto de Regiana Cruz, uma mulher de cabelo castanho cacheado preso, vestindo um moletom cinza e com óculos de pixels."
)
} else {
//se não tiver light-theme adicionar a imagem padrão
img.setAttribute("src", "./assets/avatar.png")
img.setAttribute(
"alt",
"Foto de Regiana Cruz, uma mulher de cabelo castanho cacheado preso, vestindo um moletom cinza."
)
}
}