-
Notifications
You must be signed in to change notification settings - Fork 113
/
quiz.html
690 lines (609 loc) · 23.7 KB
/
quiz.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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<link rel="website icon" href="/assets/logo/icon.png">
<link rel="icon" href="https://images.wallpapersden.com/image/download/marvel-iron-man-art_68122_2160x3840.jpg"
type="image/png">
<link href="https://unpkg.com/[email protected]/dist/aos.css" rel="stylesheet">
<link rel="stylesheet" href="css/Appearances.css" />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
<link rel="icon" href="https://images.wallpapersden.com/image/download/marvel-iron-man-art_68122_2160x3840.jpg"
type="image/png" />
<link href="https://unpkg.com/[email protected]/dist/aos.css" rel="stylesheet" />
<script src="./Js/script.js"></script>
<script src="./Js/secrets.js"></script>
<script src="https://unpkg.com/[email protected]/dist/aos.js"></script>
<title>Iron Man Quiz</title>
<nav class="navbar h-nav background">
<div class="logo" id="ironmask">
<a href="/index.html"><img src="assets/logo/icon.png" alt="logo"></a>
</div>
<ul class="nav-list visibility">
<li id="nav-home"><a href="index.html" class="active-header">Home</a>
</li>
<li id="nav-about"><a href="index.html#about">About</a></li>
<li id="nav-appearances"><a href="Appearances.html">Appearances</a></li>
<li id="nav-comics"><a href="Comics.html">Comics</a></li>
<li id="nav-contact"><a href="index.html#contact">Contact</a></li>
</ul>
<div class="rightNav visibility">
<form class="search-bar">
<input type="text" id="search-bar" name="search" placeholder="Search the website">
<button type="submit"><i class="fa-solid fa-magnifying-glass"></i></button>
</form>
</div>
<div class="burger">
<div class="line"></div>
<div class="line"></div>
<div class="line"></div>
</div>
</nav>
<style>
.nav-list {
margin-top: 30px;
background-color: black;
display: flex;
/* or whatever your default is */
/* Other styles */
}
</style>
<script>
// Select the burger and nav-list elements
const burger = document.querySelector('.burger');
const navList = document.querySelector('.nav-list');
// Add an event listener to the burger
burger.addEventListener('click', () => {
navList.classList.toggle('visibility'); // Toggle the visibility class
});
// Hide preloader and show content after page loads
window.addEventListener("load", function () {
const preloader = document.getElementById("preloader");
const content = document.getElementById("content");
// Apply fade-out effect
preloader.style.opacity = "0";
preloader.style.visibility = "hidden";
// Show content after the fade-out effect
setTimeout(() => {
content.style.display = "block";
}, 6000); // Match this delay to the CSS transition duration
});
function updateActiveLink() {
const sections = document.querySelectorAll('section'); // All your sections
const navLinks = document.querySelectorAll('.nav-list li a'); // All navigation links
let scrollPosition = document.documentElement.scrollTop || document.body.scrollTop;
sections.forEach((section) => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
if (scrollPosition >= sectionTop - 85 && scrollPosition < sectionTop + sectionHeight - 85) { //85 is header space
const activeLinkId = section.id; // Get the current section id
navLinks.forEach((link) => {
link.classList.remove('active-header'); // Remove active class from all links
});
// Add active class to the corresponding <a> tag
document.querySelector(`a[href="#${activeLinkId}"]`).classList.add('active-header');
}
});
}
window.addEventListener('scroll', updateActiveLink);
</script>
<!-- Circles -->
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div id="progress-container">
<div id="progress-bar"></div>
</div>
<style>
/* Iron Man Theme CSS */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500&display=swap');
body {
background: rgba(0, 0, 0, 0.8) url(assets/bg3.jpg);
background-size: cover;
background-blend-mode: darken;
font-family: 'Orbitron', sans-serif;
color: #f2f2f2;
display: flex;
flex-direction: column;
/* Stack elements vertically */
align-items: center;
justify-content: center;
min-height: 100vh;
margin: 0;
}
h2 {
margin-top: 90px;
font-family: Arial, sans-serif;
color: #f4b400;
font-size: 2em;
text-shadow: 0 0 5px #f4b400;
margin-bottom: 20px;
text-align: center;
/* Center align the title */
}
.container {
display: flex;
/* Use flexbox to align items side by side */
align-items: flex-start;
/* Align items at the start */
margin-top: 20px;
/* Add margin for spacing from the title */
width: 90%;
/* Set width for the container */
max-width: 1200px;
/* Set a max width for large screens */
}
.firstHalf {
flex: 0.5;
/* Image takes up half of the container */
margin-right: 20px;
/* Space between image and quiz */
}
.ironman-illustration {
width: 90%;
height: auto;
animation: IronImage 5s ease forwards,
float 3.5s ease-in-out infinite alternate;
float: left;
/* Allow the image to float */
max-width: 100%;
/* Ensure the image does not overflow */
}
.quiz-container {
background-color: #1c1c1c;
padding: 20px;
border-radius: 10px;
flex: 0.5;
/* Quiz takes up half of the container */
box-shadow: 0 0 20px rgba(255, 0, 0, 0.7);
text-align: center;
border: 2px solid #f4b400;
}
h1 {
color: #f4b400;
font-size: 2em;
text-shadow: 0 0 10px #f4b400;
margin-bottom: 10px;
}
.title {
font-family: 'Roboto', cursive;
color: #f4b400;
font-size: 10em;
text-shadow: 0 0 1px #f4b400;
margin-bottom: 10px;
}
.question {
margin-bottom: 15px;
font-weight: bold;
}
.options {
margin: 30px 0;
align-items: left;
}
.options label {
padding-left: 190px;
display: flex;
margin: 8px 0;
cursor: pointer;
color: #ff4b4b;
transition: color 0.2s ease;
}
.options input {
margin-right: 10px;
}
.options label:hover {
color: #f4b400;
}
#submit,
#quit {
background-color: #ff4b4b;
border: none;
padding: 10px 20px;
font-size: 16px;
color: #f2f2f2;
cursor: pointer;
border-radius: 5px;
text-shadow: 0 0 10px #f4b400;
transition: background-color 0.3s ease, transform 0.2s ease;
margin: 5px;
}
#submit:hover,
#quit:hover {
background-color: #f4b400;
transform: scale(1.05);
box-shadow: 0 0 10px #ff4b4b, 0 0 20px #f4b400;
}
#result {
margin-top: 20px;
font-size: 1.5em;
color: #f4b400;
text-shadow: 0 0 10px #f4b400;
}
/* Responsive Design */
@media (max-width: 800px) {
.container {
flex-direction: column;
/* Stack elements vertically on smaller screens */
}
.firstHalf {
margin-right: 0;
/* Remove right margin on smaller screens */
margin-bottom: 20px;
/* Add bottom margin for spacing */
}
.quiz-container {
width: 100%;
/* Full width for quiz on smaller screens */
}
h1 {
font-size: 1.8em;
}
h2 {
font-size: 1.2em;
}
#submit,
#quit {
font-size: 14px;
}
#result {
font-size: 1.2em;
}
}
/* Hamburger Menu */
.burger {
display: none;
position: absolute;
cursor: pointer;
right: 5%;
top: 15px;
}
.line {
width: 33px;
background-color: white;
height: 4px;
margin: 5px 3px;
}
/* Responsiveness ^_^ */
@media only screen and (max-width: 1020px) {
.logo img {
max-width: 100px;
border: 3px solid white;
border-radius: 50%;
padding: 5px;
margin: 20px 0px;
animation: glow 5s infinite alternate;
}
@keyframes glow {
from {
box-shadow: 0 0 5px -8px #6a0a0a;
}
to {
box-shadow: 0 0 10px 8px #7b0a0a;
}
}
.nav-list {
flex-direction: column;
align-items: center;
/* Added for central alignment */
margin-right: 0px;
}
.navbar {
flex-direction: column;
align-items: center;
/* Ensure content is centrally aligned */
transition: all 0.7s ease-out;
height: 480px;
}
.rightNav {
text-align: center;
width: 100%;
/* Added to adjust width */
display: flex;
flex-direction: column;
align-items: center;
/* Center-align the elements */
}
#search {
width: 300px;
/* Adjust this value to set the desired width */
padding: 8px;
margin-bottom: 10px;
text-align: center;
/* Center the placeholder text */
}
.btn {
width: 100px;
}
.secondHalf img {
width: 100%;
margin: 15px 0;
/* Adjust the top and bottom margin for spacing */
}
.burger {
display: block;
}
.h-nav {
height: 85px;
}
.visibility {
visibility: hidden;
}
.box-main {
max-width: 100%;
flex-direction: column-reverse;
align-items: center;
/* Ensure central alignment */
}
}
</style>
</head>
<body>
<h2 class="Title">Arc Reactor Challenge: <br>How Well Do You Know Iron Man?</h2> <!-- Title placed at the top -->
<div class="container">
<div class="firstHalf">
<img id="img" class="ironman-illustration" src="assets/ironman_illustration.png" alt="Ironman Illustration">
</div>
<div class="quiz-container">
<h1>Iron Man Quiz</h1>
<div id="quiz"></div>
<button id="submit">Submit Answer</button>
<button id="quit">Quit</button>
<div id="result"></div>
</div>
</div>
<button id="BacktoTop">
<div class="circle1">
<svg
id="back-to-top"
xmlns="http://www.w3.org/2000/svg"
width="30"
height="30"
fill="currentColor"
class="bi bi-arrow-up-circle-fill"
viewBox="0 0 16 16"
>
<path
d="M16 8A8 8 0 1 0 0 8a8 8 0 0 0 16 0m-7.5 3.5a.5.5 0 0 1-1 0V5.707L5.354 7.854a.5.5 0 1 1-.708-.708l3-3a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 5.707z"
></path>
</svg>
</div>
</button>
<script>
/* Back to Top Button */
const scrollToTopBtn = document.getElementById("BacktoTop");
window.onscroll = function () {
scrollFunction();
};
function scrollFunction() {
if (
document.body.scrollTop > 50 ||
document.documentElement.scrollTop > 50
) {
scrollToTopBtn.style.visibility = "visible";
scrollToTopBtn.style.opacity = "1";
} else {
scrollToTopBtn.style.visibility = "hidden";
scrollToTopBtn.style.opacity = "0";
}
}
scrollToTopBtn.addEventListener("click", function () {
// Smooth scroll back to top
window.scrollTo({ top: 0, behavior: "smooth" });
});
</script>
<footer>
<div class="footer background" style="font-family: Arial, sans-serif;">
<div class="footer-col">
<div class="footer-img">
<img src="/assets/logo/icon.png" id="ironlogo" alt="">
</div>
<div class="visitor-counter">
<span class="icon">👁️</span> <!-- You can replace this with an eye icon image if you prefer -->
<span id="visitorCount">Visitors Count:</span>
<span class="website-counter">0</span>
</div>
<script>
// Function to get the count from localStorage or initialize it
function getVisitorCount() {
return localStorage.getItem('visitorCount') || 0;
}
// Function to increment and save the count
function incrementVisitorCount() {
let count = parseInt(getVisitorCount()) + 1;
localStorage.setItem('visitorCount', count);
return count;
}
// Function to display the count
function displayVisitorCount() {
const counterElement = document.querySelector('.website-counter');
const count = incrementVisitorCount();
counterElement.textContent = count;
}
// Call the display function when the page loads
document.addEventListener('DOMContentLoaded', displayVisitorCount);
</script>
<p class="footer-p">
<!-- Iron Man is a fictional superhero in the Marvel Comics universe, created by writer Stan Lee. His real name is Tony Stark, a billionaire industrialist and genius inventor who builds a high-tech suit of powered armor to fight crime after a life-threatening injury. -->
<!-- Iron Man, or Tony Stark, is a billionaire genius who becomes a superhero with his advanced armored suit. -->
<!-- Iron Man, Tony Stark, is a tech genius who fights for justice in a powerful, high-tech suit of armor he created. -->
Iron Man, aka Tony Stark, is a tech genius and billionaire who uses his advanced armored suit to
fight for justice.
</p>
<div class="footer-social">
<a href="#"><i class="fa-brands fa-github"></i></a>
<a href="#"><i class="fa-brands fa-instagram"></i></a>
<a href="#"><i class="fa-brands fa-square-x-twitter"></i></a>
<a href="#"><i class="fa-brands fa-facebook"></i></a>
<a href="#"><i class="fa-brands fa-linkedin"></i></a>
</div>
</div>
<div class="footer-col-main">
<h4 class="h46">Overview</h4>
<a href="index.html">Who is Iron Man?</a>
<a href="/merchandise.html">Buy Merchandise</a>
<a href="#">Community</a>
<a href="#">Franchise</a>
<a href="Achievements.html">Remarkable Achievements</a>
<a href="#">Media Kit</a>
</div>
<div class="footer-col-main">
<h4 class="h46">About Us</h4>
<a href="blog.html">Blogs</a>
<a href="/contributor.html">Contributors</a>
<a href="#">Careers</a>
</div>
<div class="footer-col-main">
<h4 class="h46">Contact Us</h4>
<a href="FAQs.html">Help/Faq's</a>
<a href="index.html#contact">Contact</a>
<a href="PrivacyPolicy.html">Privacy Policy</a>
<a href="Terms&Conditions.html">Terms & Conditions</a>
<a href="#">Advertising</a>
</div>
</div>
<div class="footer-bar background" style="font-family: Arial, sans-serif;">
<p>
© Copyright 2024- All Rights Reserved -Made With ❤️ by <a class="mygithub"
href="https://github.com/aslams2020"><span>Aslam</span> Sayyad</a>
</p>
</div>
<style>
.footer-bar p{
font-weight: 300;
font-size: 1em;
}
.footer-p{
color: white;
font-weight: 300;
font-size: 1em;
}
</style>
</footer>
<script>
const quizData = [
{
question: "What is Iron Man's real name?",
options: ["Tony Stark", "Steve Rogers", "Bruce Banner", "Peter Parker"],
answer: "Tony Stark"
},
{
question: "What powers Iron Man's suit?",
options: ["Arc Reactor", "Magic", "Gamma Radiation", "Electricity"],
answer: "Arc Reactor"
},
{
question: "Who created Iron Man's suit?",
options: ["Pepper Potts", "Tony Stark", "Bruce Wayne", "Nick Fury"],
answer: "Tony Stark"
},
{
question: "What company does Tony Stark own?",
options: ["Stark Industries", "Oscorp", "Wayne Enterprises", "LexCorp"],
answer: "Stark Industries"
},
{
question: "Which element does Tony Stark create to replace his palladium core?",
options: ["Vibranium", "Titanium", "Plutonium", "New Element"],
answer: "New Element"
},
{
question: "What is the name of Iron Man's AI assistant?",
options: ["J.A.R.V.I.S.", "Friday", "Ultron", "Vision"],
answer: "J.A.R.V.I.S."
},
{
question: "What color is Iron Man's Mark III suit?",
options: ["Red and Gold", "Black and Silver", "Blue and White", "Green and Yellow"],
answer: "Red and Gold"
},
{
question: "Which superhero team is Iron Man a founding member of?",
options: ["The Avengers", "X-Men", "Fantastic Four", "Guardians of the Galaxy"],
answer: "The Avengers"
}
];
let currentQuestionIndex = 0;
let score = 0;
const quizContainer = document.getElementById("quiz");
const submitButton = document.getElementById("submit");
const quitButton = document.getElementById("quit");
const resultContainer = document.getElementById("result");
function loadQuestion() {
const currentQuestion = quizData[currentQuestionIndex];
quizContainer.innerHTML = `
<div class="question">
<p>${currentQuestion.question}</p>
<div class="options">
${currentQuestion.options.map(option => `
<label>
<input type="radio" name="option" value="${option}">
${option}
</label>
`).join('')}
</div>
</div>
`;
}
function calculateScore() {
const selectedOption = document.querySelector(`input[name="option"]:checked`);
if (selectedOption && selectedOption.value === quizData[currentQuestionIndex].answer) {
score++;
}
currentQuestionIndex++;
if (currentQuestionIndex < quizData.length) {
loadQuestion();
} else {
displayScore();
}
}
function displayScore() {
quizContainer.style.display = 'none';
submitButton.style.display = 'none';
quitButton.style.display = 'none';
resultContainer.innerHTML = `
<p>Your final score: ${score} out of ${quizData.length}</p>
<p>Great job! Thanks for playing!</p>
`;
}
function quitQuiz() {
quizContainer.style.display = 'none';
submitButton.style.display = 'none';
quitButton.style.display = 'none';
resultContainer.innerHTML = `
<p>Quiz exited. Your score was: ${score} out of ${quizData.length}</p>
<p>Come back to try again!</p>
`;
}
loadQuestion();
submitButton.addEventListener("click", calculateScore);
quitButton.addEventListener("click", quitQuiz);
</script>
</body>
</html>