-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvamos_sair.html
100 lines (88 loc) · 2.7 KB
/
vamos_sair.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
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Você aceita sair comigo?</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 0;
padding: 0;
overflow: hidden;
position: relative;
height: 100vh;
width: 100vw;
}
h1 {
font-size: 2rem;
margin-bottom: 10px;
}
button {
font-size: 1rem;
padding: 10px 20px;
margin: 10px;
cursor: pointer;
position: absolute;
}
#sim-button {
top: calc(10% + 5px);
left: calc(45% - 60px);
}
#nao-button {
top: calc(10% + 5px);
left: calc(45% + 60px);
}
#nervoso-screen {
display: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: white;
color: black;
display: none;
align-items: center;
justify-content: center;
font-size: 2rem;
z-index: 10;
}
</style>
</head>
<body>
<h1>Você aceita sair comigo?</h1>
<button id="sim-button">SIM</button>
<button id="nao-button">NÃO</button>
<div id="nervoso-screen">Eita, Calma... Errei, Desculpa, Estou Nervoso...</div>
<script>
const simButton = document.getElementById('sim-button');
const naoButton = document.getElementById('nao-button');
const nervosoScreen = document.getElementById('nervoso-screen');
function randomizeButtonPosition(button) {
const windowWidth = window.innerWidth;
const windowHeight = window.innerHeight;
let newX, newY;
do {
newX = Math.random() * (windowWidth - button.offsetWidth);
newY = Math.random() * (windowHeight - button.offsetHeight);
} while (
Math.abs(newX - naoButton.offsetLeft) < 50 &&
Math.abs(newY - naoButton.offsetTop) < 50
);
button.style.left = `${newX}px`;
button.style.top = `${newY}px`;
}
simButton.addEventListener('mouseover', () => {
randomizeButtonPosition(simButton);
});
simButton.addEventListener('click', () => {
randomizeButtonPosition(simButton);
});
naoButton.addEventListener('click', () => {
nervosoScreen.style.display = 'flex';
});
</script>
</body>
</html>