-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercicio02.html
79 lines (67 loc) · 2.08 KB
/
exercicio02.html
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lâmpada</title>
</head>
<style>
body {
width: 100%;
height: 100vh;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 50px;
}
button {
font-family: sans-serif;
text-transform: uppercase;
font-weight: 700;
padding: 5px;
border: dotted 3px green;
background-color: #fff;
cursor: pointer;
transition: 500ms;
}
button:hover {
background-color: green;
color: #fff;
border-radius: 5px 0;
}
</style>
<body>
<div>
<img id="lampApagada" onmouseenter="mouseEntrou()" src="img/apagada.jpg" alt="Imagem de uma lâmpada">
<img id="lampAcesa" onmouseout="mouseSaiu()" onclick="quebrar()" src="img/luz.jpg" alt="" style="display: none;">
<img id="lampQuebrada" src="img/quebrada.jpg" alt="" style="display: none;">
</div>
<button id="btn" onclick="renovarLamp()">Renovar lâmpada</button>
<script>
let lampApagada = document.getElementById('lampApagada')
let lampAcesa = document.getElementById('lampAcesa')
let lampQuebrada = document.getElementById('lampQuebrada')
let btn = document.getElementById('btn')
function mouseEntrou() {
lampApagada.style.display = "none"
lampAcesa.style.display = ""
}
function mouseSaiu() {
lampAcesa.style.display = "none"
lampApagada.style.display = ""
}
function quebrar() {
lampQuebrada.style.display = ""
lampAcesa.style.width = "0px"
lampApagada.style.width = "0px"
}
function renovarLamp() {
lampQuebrada.style.display = "none"
lampApagada.style.width = "fit-content"
lampAcesa.style.width = "fit-content"
}
</script>
</body>
</html>