-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
90 lines (72 loc) · 2.25 KB
/
index.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
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>O Melhor Amigo do Homem</title>
<style>
body{
background-color: blue;
}
.painel{
margin: auto;
background-color: white;
width: 500px;
height: 500px;
border-radius: 20px;
text-align: center;
padding-top: 50px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
#sim{
height: 40px;
width: 60px;
background-color: blue;
border: 2px solid white;
border-radius: 10px;
color: white;
font-weight: bold;
cursor: pointer;
margin-left: -50px;
}
#nao{
position: absolute;
height: 40px;
width: 60px;
background-color: blue;
border: 2px solid white;
border-radius: 10px;
color: white;
font-weight: bold;
cursor: pointer;
margin-left: 10px;
}
</style>
</head>
<body>
<div class="painel">
<h1>O Melhor Amigo do Homem</h1>
<img src="img/dog.gif" alt="cao">
<h2>Você Ama o seu Pet?</h2>
<button id="sim" onclick="parabens()"> Sim! </button>
<button onmouseover="fuja()" id="nao"> Não! </button>
</div>
<script>
function fuja(){
var botaoNao = document.getElementById("nao")
var larguraJanela = window.innerWidth;
var alturaJanela = window.innerHeight;
var maxX = larguraJanela - botaoNao.offsetWidth;
var maxY = alturaJanela - botaoNao.offsetHeight;
var aleatorioX = Math.floor(Math.random() * maxX);
var aleatorioY = Math.floor(Math.random() * maxY);
botaoNao.style.left = aleatorioX + "px";
botaoNao.style.top = aleatorioY + "px";
}
function parabens() {
alert("Parabéns, Você é Uma Ótima Pessoa :)");
}
</script>
</body>
</html>