Skip to content

Commit 048843d

Browse files
finalizado
1 parent 7d594de commit 048843d

File tree

9 files changed

+41
-22
lines changed

9 files changed

+41
-22
lines changed

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"liveServer.settings.port": 5501
3+
}

assets/audio/audio1.mp3

32.2 KB
Binary file not shown.

assets/audio/audio2.mp3

110 KB
Binary file not shown.

assets/audio/music.mp3

1.94 MB
Binary file not shown.

assets/img/bg2.jpg

122 KB
Loading

assets/img/bg3.jpg

183 KB
Loading

assets/img/simb.png

-3.47 KB
Binary file not shown.

index.html

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ <h3>
2727
<div class="img">
2828
<img id="imagem" src="./assets/img/naruto1.jpg" alt="" />
2929
</div>
30+
<audio autoplay controls src="./assets/audio/music.mp3"></audio>
31+
3032
</div>
3133
</section>
3234
</main>

js.js

+36-22
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,39 @@
1-
const elementoNome = document.getElementById('nome');
2-
const elementoSituacao = document.querySelector('#situacao');
3-
const elementoImg = document.querySelector('#imagem')
4-
let elementoBtn = document.querySelector('#alterar')
1+
const elementoNome = document.getElementById("nome");
2+
const elementoSituacao = document.querySelector("#situacao");
3+
const elementoImg = document.querySelector("#imagem");
4+
// const elementoBg = document.body.style.backgroundImage;
5+
let elementoBtn = document.querySelector("#alterar");
56

6-
elementoBtn.addEventListener('click', () =>{
7+
elementoBtn.addEventListener("click", () => {
8+
if (elementoBtn.value == "primeiro") {
9+
elementoImg.src = "./assets/img/naruto1.jpg";
10+
elementoNome.innerText = "Naruto Uzumaki ";
11+
elementoSituacao.innerText = "Normal";
12+
document.body.style.backgroundImage = "url('./assets/img/bg.jpg')";
713

8-
if(elementoBtn.value == 'primeiro'){
9-
elementoImg.src = '../assets/img/naruto1.jpg'
10-
elementoNome.innerText = 'Naruto Uzumaki '
11-
elementoSituacao.innerText = 'Normal'
12-
elementoBtn.value = 'segundo'
13-
} else if(elementoBtn.value == 'segundo') {
14+
15+
elementoBtn.value = "segundo";
16+
} else if (elementoBtn.value == "segundo") {
17+
elementoImg.src = "./assets/img/naruto2.png";
18+
elementoNome.innerText = "Naruto 1 cauda";
19+
elementoSituacao.innerText = "Descontrolado";
20+
document.body.style.backgroundImage = "url('./assets/img/bg2.jpg')";
21+
document
22+
23+
elementoBtn.value = "terceiro";
24+
} else {
25+
elementoImg.src = "./assets/img/naruto3.jpg";
26+
elementoNome.innerText = "Naruto 4 caudas";
27+
elementoSituacao.innerText = "Chama o Yamato";
28+
document.body.style.backgroundImage = "url('./assets/img/bg3.jpg')";
29+
elementoBtn.value = "primeiro";
30+
}
31+
});
1432

15-
elementoImg.src = '../assets/img/naruto2.png'
16-
elementoNome.innerText = 'Naruto uma cauda'
17-
elementoSituacao.innerText = 'Descontrolado'
18-
elementoBtn.value = 'terceiro'
19-
} else {
20-
elementoImg.src = '../assets/img/naruto3.jpg'
21-
elementoNome.innerText = 'Naruto Capiroto'
22-
elementoSituacao.innerText = 'Chama o Yamato'
23-
elementoBtn.value = 'primeiro'
24-
}
25-
})
33+
function AsyncTrocaImg() {
34+
$.post(base + "Home/GetNewImg", {}, function (URL) {
35+
$('body').css('background-image', 'url('+URL+')');
36+
}).fail(function () {
37+
console.log("error");
38+
})
39+
}

0 commit comments

Comments
 (0)