-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
21 lines (18 loc) · 727 Bytes
/
script.js
File metadata and controls
21 lines (18 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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, adicionar a imagem light
img.setAttribute("src", "./assets/avatar-light.png")
img.setAttribute(
"alt", 'Foto de Mayk Brito sorrindo, usando óculos escuro e camisa preta, barba e fundo neon.')
} else {
// se tiver sem light mode, manter a imagem normal
img.setAttribute("src", "./assets/avatar.png")
img.setAttribute( "alt",
'Foto de Mayk Brito sorrindo, usando óculos e camisa preta, barba e fundo neon.' )
}
}