-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmcdonalds_survey.html
379 lines (365 loc) · 9.66 KB
/
mcdonalds_survey.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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>McDonald's Survey - RealSurveys</title>
<style>
body {
margin: 0;
font-family: 'Arial', sans-serif;
background-color: rgba(240, 242, 245, 0.4);
color: #333;
background-image: url('https://github.com/Master120344/RealSurveys/blob/main/assets/Screenshot_20240811-114733~2.png?raw=true');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
header {
background-color: #ffc300;
color: #fff;
padding: 20px 0;
position: sticky;
top: 0;
z-index: 1000;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
header .container {
display: flex;
justify-content: space-between;
align-items: center;
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
header h1 {
margin: 0;
font-size: 28px;
color: #d90000;
text-align: left;
}
header h1 a {
color: inherit;
text-decoration: none;
}
.hero {
background-color: rgba(217, 0, 0, 0.8);
height: 200px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
color: #fff;
position: relative;
}
.hero h2 {
position: relative;
font-size: 36px;
margin: 0;
z-index: 1;
}
.content {
padding: 60px 20px;
max-width: 800px;
margin: 0 auto;
text-align: center;
background-color: rgba(255, 255, 255, 0.9);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
border-radius: 10px;
border: 4px solid #ffc300;
margin-top: -50px;
position: relative;
z-index: 2;
}
.content h2 {
font-size: 28px;
margin-bottom: 20px;
color: #d90000;
}
.content p {
font-size: 18px;
line-height: 1.6;
margin-bottom: 20px;
color: #333;
}
.survey-question {
display: none;
margin-bottom: 20px;
text-align: left;
padding: 20px;
background-color: rgba(255, 255, 255, 1);
border-radius: 8px;
border: 1px solid #ffc300;
}
.survey-question.active {
display: block;
}
.survey-question label {
font-size: 18px;
color: #333;
}
.survey-question .options {
margin-top: 10px;
}
.survey-question .options input {
margin-right: 10px;
}
.survey-question .options label {
font-size: 16px;
margin-right: 20px;
}
.survey-nav {
display: flex;
justify-content: space-between;
margin-top: 20px;
}
.btn {
display: inline-block;
padding: 10px 20px;
background-color: #ffc300;
color: #333;
text-decoration: none;
border-radius: 5px;
transition: background-color 0.3s, transform 0.3s;
}
.btn:hover {
background-color: #d90000;
color: #fff;
transform: scale(1.05);
}
footer {
background-color: #ffc300;
color: #333;
padding: 20px 0;
text-align: center;
}
footer .container {
display: flex;
flex-direction: column;
align-items: center;
}
footer p {
margin: 0;
}
footer .social {
margin-top: 10px;
}
footer .social a {
color: #333;
margin: 0 10px;
font-size: 18px;
text-decoration: none;
transition: color 0.3s;
}
footer .social a:hover {
color: #d90000;
}
@media (max-width: 768px) {
header .container {
flex-direction: column;
}
.content {
padding: 20px;
}
.content h2 {
font-size: 24px;
}
.content p {
font-size: 16px;
}
footer .container {
padding: 0 20px;
}
}
.timer {
display: none;
margin: 20px 0;
padding: 10px;
background-color: yellow;
color: red;
font-size: 18px;
font-weight: bold;
border-radius: 5px;
}
</style>
</head>
<body>
<header>
<div class="container">
<h1><a href="index.html">RealSurveys</a></h1>
</div>
</header>
<div class="hero">
<!-- Hero section with no white text -->
<h2>McDonald's Survey</h2>
</div>
<section class="content">
<div class="container">
<h2>McDonald's Survey</h2>
<p>Complete this survey to earn rewards. Your feedback is valuable to us!</p>
<form id="mcdonaldsSurveyForm">
<div class="survey-question active" data-question="1">
<p>Question 1/5</p>
<label for="q1">How often do you eat at McDonald's?</label>
<div class="options">
<input type="radio" id="q1_daily" name="q1" value="Daily">
<label for="q1_daily">Daily</label>
<input type="radio" id="q1_weekly" name="q1" value="Weekly">
<label for="q1_weekly">Weekly</label>
<input type="radio" id="q1_monthly" name="q1" value="Monthly">
<label for="q1_monthly">Monthly</label>
<input type="radio" id="q1_rarely" name="q1" value="Rarely">
<label for="q1_rarely">Rarely</label>
</div>
</div>
<div class="survey-question" data-question="2">
<p>Question 2/5</p>
<label for="q2">What is your favorite McDonald's menu item?</label>
<div class="options">
<input type="radio" id="q2_burger" name="q2" value="Burger">
<label for="q2_burger">Burger</label>
<input type="radio" id="q2_fries" name="q2" value="Fries">
<label for="q2_fries">Fries</label>
<input type="radio" id="q2_nuggets" name="q2" value="Nuggets">
<label for="q2_nuggets">Nuggets</label>
<input type="radio" id="q2_sundae" name="q2" value="Sundae">
<label for="q2_sundae">Sundae</label>
</div>
</div>
<div class="survey-question" data-question="3">
<p>Question 3/5</p>
<label for="q3">How would you rate the service at McDonald's?</label>
<div class="options">
<input type="radio" id="q3_excellent" name="q3" value="Excellent">
<label for="q3_excellent">Excellent</label>
<input type="radio" id="q3_good" name="q3" value="Good">
<label for="q3_good">Good</label>
<input type="radio" id="q3_average" name="q3" value="Average">
<label for="q3_average">Average</label>
<input type="radio" id="q3_poor" name="q3" value="Poor">
<label for="q3_poor">Poor</label>
</div>
</div>
<div class="survey-question" data-question="4">
<p>Question 4/5</p>
<label for="q4">What improvements would you like to see?</label>
<div class="options">
<input type="radio" id="q4_menu" name="q4" value="Menu">
<label for="q4_menu">Menu</label>
<input type="radio" id="q4_service" name="q4" value="Service">
<label for="q4_service">Service</label>
<input type="radio" id="q4_cleanliness" name="q4" value="Cleanliness">
<label for="q4_cleanliness">Cleanliness</label>
<input type="radio" id="q4_price" name="q4" value="Price">
<label for="q4_price">Price</label>
</div>
</div>
<div class="survey-question" data-question="5">
<p>Question 5/5</p>
<label for="q5">Let McDonald's know how they can improve.</label>
<textarea id="q5" name="q5" rows="4"></textarea>
</div>
<div class="survey-nav">
<button type="button" id="prevButton" class="btn" style="display: none;" disabled>Previous</button>
<button type="button" id="nextButton" class="btn" disabled>Next</button>
<button type="submit" id="submitButton" class="btn" style="display: none;" disabled>Submit</button>
</div>
</form>
<div id="timer" class="timer"></div>
</div>
</section>
<footer>
<div class="container">
<p>© 2024 RealSurveys. All rights reserved.</p>
<div class="social">
<a href="https://www.facebook.com/RealSurveys" target="_blank">Facebook</a>
<a href="https://www.twitter.com/RealSurveys" target="_blank">Twitter</a>
<a href="https://www.instagram.com/RealSurveys" target="_blank">Instagram</a>
</div>
</div>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/confetti-js/0.0.17/confetti.browser.min.js"></script>
<script>
let currentQuestion = 1;
const totalQuestions = 5;
const nextButton = document.getElementById('nextButton');
const prevButton = document.getElementById('prevButton');
const submitButton = document.getElementById('submitButton');
const timerElement = document.getElementById('timer');
let isTimerRunning = false;
function showQuestion(questionNumber) {
const questions = document.querySelectorAll('.survey-question');
questions.forEach(question => {
question.classList.remove('active');
});
document.querySelector(`.survey-question[data-question="${questionNumber}"]`).classList.add('active');
if (questionNumber === 1) {
prevButton.style.display = 'none';
} else {
prevButton.style.display = 'inline-block';
}
if (questionNumber === totalQuestions) {
nextButton.style.display = 'none';
submitButton.style.display = 'inline-block';
} else {
nextButton.style.display = 'inline-block';
submitButton.style.display = 'none';
}
}
function startTimer(duration, display) {
let timer = duration, minutes, seconds;
display.style.display = 'block';
isTimerRunning = true;
const interval = setInterval(() => {
minutes = parseInt(timer / 60, 10);
seconds = parseInt(timer % 60, 10);
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
display.textContent = `Time left: ${minutes}:${seconds}`;
if (--timer < 0) {
clearInterval(interval);
isTimerRunning = false;
nextButton.disabled = false;
}
}, 1000);
}
nextButton.addEventListener('click', () => {
if (currentQuestion < totalQuestions) {
currentQuestion++;
showQuestion(currentQuestion);
nextButton.disabled = true;
prevButton.disabled = true;
startTimer(10, timerElement);
}
});
prevButton.addEventListener('click', () => {
if (currentQuestion > 1) {
currentQuestion--;
showQuestion(currentQuestion);
nextButton.disabled = true;
prevButton.disabled = true;
startTimer(10, timerElement);
}
});
document.getElementById('mcdonaldsSurveyForm').addEventListener('submit', function(e) {
e.preventDefault();
// Update content to show thank you message and confetti
document.querySelector('.content').innerHTML = `
<div style="text-align: center; margin: 20px;">
<h2>Thank you for completing the survey!</h2>
<div id="confetti"></div>
</div>
`;
// Start confetti animation
const confetti = new ConfettiGenerator({ target: 'confetti' });
confetti.render();
// Redirect after 5 seconds
setTimeout(() => {
window.location.href = 'surveys.html';
}, 5000);
});
showQuestion(currentQuestion);
startTimer(10, timerElement);
</script>
</body>
</html>