|
1 | 1 | const elementoNome = document.getElementById("nome");
|
2 | 2 | const elementoSituacao = document.querySelector("#situacao");
|
3 | 3 | const elementoImg = document.querySelector("#imagem");
|
4 |
| - |
5 | 4 | let elementoBtn = document.querySelector("#alterar");
|
6 | 5 |
|
| 6 | + |
7 | 7 | elementoBtn.addEventListener("click", () => {
|
8 | 8 | if (elementoBtn.value == "primeiro") {
|
9 | 9 | elementoImg.src = "./assets/img/naruto1.png";
|
10 | 10 | elementoNome.innerText = "Naruto Uzumaki ";
|
11 | 11 | elementoSituacao.innerText = "Normal";
|
12 | 12 | document.body.style.background = "url('./assets/img/bg.jpg')";
|
13 |
| - |
| 13 | + document.body.style.backgroundRepeat = "no-repeat"; |
| 14 | + document.body.style.backgroundSize = "cover"; |
14 | 15 | elementoBtn.value = "segundo";
|
15 | 16 | } else if (elementoBtn.value == "segundo") {
|
16 | 17 | elementoImg.src = "./assets/img/naruto2.png";
|
17 | 18 | elementoNome.innerText = "Naruto 1 cauda";
|
18 | 19 | elementoSituacao.innerText = "Descontrolado";
|
19 | 20 | document.body.style.background = "url('./assets/img/bg2.jpg')";
|
20 |
| - |
| 21 | + document.body.style.backgroundRepeat = "no-repeat"; |
| 22 | + document.body.style.backgroundSize = "cover"; |
21 | 23 | elementoBtn.value = "terceiro";
|
22 | 24 | } else if (elementoBtn.value == "terceiro") {
|
23 | 25 | elementoImg.src = "./assets/img/naruto3.png";
|
24 | 26 | elementoNome.innerText = "Naruto 4 caudas";
|
25 | 27 | elementoSituacao.innerText = "Chama o Yamato";
|
26 | 28 | document.body.style.background = "url('./assets/img/bg3.jpg')";
|
| 29 | + document.body.style.backgroundRepeat = "no-repeat"; |
| 30 | + document.body.style.backgroundSize = "cover"; |
27 | 31 | elementoBtn.value = "quarto";
|
28 | 32 | } else {
|
29 | 33 | elementoImg.src = "./assets/img/naruto4.png";
|
30 | 34 | elementoNome.innerText = "Naruto 6 caudas";
|
31 | 35 | elementoSituacao.innerText = "É o fim do Pain";
|
32 | 36 | document.body.style.background = "url('./assets/img/bg4.jpg')";
|
| 37 | + document.body.style.backgroundRepeat = "no-repeat"; |
| 38 | + document.body.style.backgroundSize = "cover"; |
33 | 39 | elementoBtn.value = "primeiro";
|
34 | 40 | }
|
35 | 41 | });
|
0 commit comments