-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
82 lines (80 loc) · 3.31 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HEPI 26</title>
<style>
h1 {
text-align: center;
}
</style>
</head>
<body>
<h1>Znajdź niespodziankę!</h1>
<div style="display: flex; justify-content: space-around;">
<div style="text-align: center;">
<img src="closed.png" alt="Pudełko nr 1" width="150" onclick="revealGift(1)">
<p>Pudełko nr 1</p>
</div>
<div style="text-align: center;">
<img src="closed.png" alt="Pudełko nr 2" width="150" onclick="revealGift(2)">
<p>Pudełko nr 2</p>
</div>
<div style="text-align: center;">
<img src="closed.png" alt="Pudełko nr 3" width="150" onclick="revealGift(3)">
<p>Pudełko nr 3</p>
</div>
<div style="text-align: center;">
<img src="closed.png" alt="Pudełko nr 4" width="150" onclick="revealGift(4)">
<p>Pudełko nr 4</p>
</div>
<div style="text-align: center;">
<img src="closed.png" alt="Pudełko nr 5" width="150" onclick="revealGift(5)">
<p>Pudełko nr 5</p>
</div>
</div>
<div id="giftDisplay" style="text-align: center;"></div>
<script>
var gifClicked = false;
function revealGift(pudelko) {
var giftDisplay = document.getElementById('giftDisplay');
if (pudelko === 1 || pudelko === 2 || pudelko === 3 || pudelko === 5) {
if (!gifClicked) {
if (pudelko === 1) {
giftDisplay.innerHTML = '<img src="opened.png" alt="Prezent 1" width="200">';
} else if (pudelko === 2) {
giftDisplay.innerHTML = '<img src="opened2.png" alt="Prezent 2" width="200">';
} else if (pudelko === 3) {
giftDisplay.innerHTML = '<img src="opened3.png" alt="Prezent 3" width="200">';
} else if (pudelko === 5) {
giftDisplay.innerHTML = '<img src="opened4.png" alt="Prezent 5" width="200">';
}
}
} else if (pudelko === 4) {
var gifContainer = '<img src="pedro.gif" alt="Prezent 4" width="200">';
giftDisplay.innerHTML = gifContainer;
gifClicked = true;
setInterval(function() {
var randomColor = '#' + Math.floor(Math.random() * 16777215).toString(16);
var pedroText = document.createElement('div');
pedroText.textContent = 'PEDRO';
pedroText.style.position = 'absolute';
pedroText.style.left = Math.random() * (window.innerWidth - 100) + 'px';
pedroText.style.top = Math.random() * (window.innerHeight - 100) + 'px';
pedroText.style.color = randomColor;
document.body.appendChild(pedroText);
}, 1000);
var stoLatText = document.createElement('div');
stoLatText.textContent = 'STO LAT';
stoLatText.style.position = 'absolute';
stoLatText.style.left = '50%';
stoLatText.style.bottom = '10%';
stoLatText.style.transform = 'translateX(-50%)';
stoLatText.style.fontSize = '24px';
stoLatText.style.fontWeight = 'bold';
stoLatText.style.color = 'red';
document.body.appendChild(stoLatText);
}
}
</script>