-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
71 lines (60 loc) · 2.5 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
<!DOCTYPE html>
<html lang="en">
<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>Can we hang out sometime?</title>
</head>
<body>
<style>
* {
font-size: 30px;
}
body {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
</style>
<div>
<h1>Can we hang out sometime?</h1>
<img src="https://media.tenor.com/zGm5acSjHCIAAAAC/cat-begging.gif"><br>
<button>Yes, we can</button>
<input type="button" value="No, we can't">
</div>
<script>
const img = [
'https://media2.giphy.com/media/dBZnwwejzgf92kl7tD/giphy.gif?cid=ecf05e47612fylaei2j0v2j8qw9rdqhisvd6s52bkkfifb00&rid=giphy.gif&ct=g',
'https://media1.giphy.com/media/M9C8PHLkh0hQxraaLG/giphy.gif?cid=790b7611f6852ff53999980c11add19df5ed6568f4312720&rid=giphy.gif&ct=g',
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQMBdSuNWY1KZsMuBlFcDvO3Nm5j_nfaOJd8g&usqp=CAU',
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSPcu7K9YD_WiDBe5UV4OlkNyusTbPebNI3Pw&usqp=CAU',
]
let count = -1;
document.querySelector('button').addEventListener('click', () => {
alert('Thank you ><')
document.querySelector('h1').innerHTML='🤗🤗🤗Thank you 🤗🤗🤗'
document.querySelector('img').src='https://i.imgflip.com/cnudu.jpg'
})
const input = document.querySelector('input');
input.addEventListener('click', move)
function move(e) {
count = count === (img.length - 1)? count: ++count;
if (count === 0)
document.querySelector('h1').innerHTML="I won't take no for an answer"
else if (count === 1)
document.querySelector('h1').innerHTML="Yes, please :)"
else {
input.addEventListener('mouseover', move)
var w = window.innerWidth;
var h = window.innerHeight;
input.style.setProperty('position', 'fixed')
input.style.setProperty('left', `${Math.floor(Math.random() * w)}px`)
input.style.setProperty('top',` ${Math.floor(Math.random() * h)}px`)
}
document.querySelector('img').src=img[count]
}
</script>
</body>
</html>