-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
164 lines (150 loc) · 4.3 KB
/
index.html
File metadata and controls
164 lines (150 loc) · 4.3 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!DOCTYPE html>
<html lang="he" dir="rtl">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>שלום יוגב</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<style>
html {
height: 100%;
}
body {
height: 100%;
font-family: Arial, sans-serif;
margin: 0;
padding: 2rem;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-image: url('yogev.png');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
margin: 0;
padding: 2rem;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.card {
background: white;
padding: 2rem;
border-radius: 1rem;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
max-width: 500px;
width: 100%;
transition: all 0.5s ease;
}
.question {
font-size: 1.5rem;
margin-bottom: 1.5rem;
}
.answers {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1rem;
}
.answer-btn {
padding: 0.75rem 1rem;
background: #f9fafb;
border: 2px solid #e5e7eb;
border-radius: 0.5rem;
cursor: pointer;
font-size: 1rem;
transition: background 0.3s;
}
.answer-btn:hover {
background: #e5e7eb;
}
/* Flicker animation for red background */
@keyframes flicker {
0% { background-color: red; }
50% { background-color: white; }
100% { background-color: red; }
}
/* Shake animation */
@keyframes shake {
0% { transform: translateX(0); }
25% { transform: translateX(-10px); }
50% { transform: translateX(10px); }
75% { transform: translateX(-10px); }
100% { transform: translateX(10px); }
}
/* Apply the shake effect */
.shake {
animation: shake 0.5s ease;
}
/* Apply the flicker effect */
.flicker {
animation: flicker 0.5s alternate 3;
}
</style>
</head>
<body>
<div class="bg"></div>
<div class="card" id="quiz">
<div class="question" id="question">Loading...</div>
<div class="answers" id="answers"></div>
</div>
<script>
const questions = [
{
text: "שלום יוגב",
answers: ["איזה קטע גם אני יוגב", "מי זה יוגב", "מה"],
correct: "איזה קטע גם אני יוגב",
},
{
text: "זה מזכיר לי את הפעם ההיא",
answers: ["שהיית יוגב?", "איזו פעם?", "מזה החרא הזה", "הסר"],
correct: "שהיית יוגב?",
}
];
let currentIndex = 0;
const questionEl = document.getElementById("question");
const answersEl = document.getElementById("answers");
function showQuestion(index) {
const q = questions[index];
questionEl.textContent = q.text;
answersEl.innerHTML = "";
q.answers.forEach((answer) => {
const btn = document.createElement("button");
btn.className = "answer-btn";
btn.textContent = answer;
btn.onclick = () => {
if (answer === q.correct) {
btn.style.backgroundColor = "green";
setTimeout(() => {
btn.style.backgroundColor = "";
nextQuestion();
}, 800); // Reset after animation duration (800ms)
} else {
// Make button red
btn.style.backgroundColor = "red";
// Add both shake and flicker animations
btn.classList.add('shake');
btn.classList.add('flicker');
// After animations, reset the button's state
setTimeout(() => {
btn.classList.remove('flicker', 'shake');
btn.style.backgroundColor = ""; // Reset the background color
}, 800); // Reset after animation duration (800ms)
}
};
answersEl.appendChild(btn);
});
}
function nextQuestion() {
if (questions.length == currentIndex + 1) {
alert('וואו רונישי');
} else {
currentIndex = (currentIndex + 1) % questions.length;
setTimeout(() => showQuestion(currentIndex), 300);
}
}
showQuestion(currentIndex);
</script>
</body>
</html>