-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
24 lines (22 loc) · 721 Bytes
/
script.js
File metadata and controls
24 lines (22 loc) · 721 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
function toggleMode() {
const html = document.documentElement
html.classList.toggle("light")
// pegar a tag img
const img = document.querySelector("#profile img")
// substituir a imagem
if (html.classList.contains("light")) {
// se tiver light mode, add a img light
img.setAttribute("src", "./assets/avatar-light.png")
img.setAttribute(
"alt",
"Foto de perfil de Mikael Monteiro de óculos escuros com a cidade ao fundo"
)
} else {
// se não tiver com light mode, manter a img normal
img.setAttribute("src", "./assets/avatar.png")
img.setAttribute(
"alt",
"Foto de perfil de Mikael Monteiro sorrindo com fundo azul"
)
}
}