Current Affairs Quiz /* Basic CSS resets */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: Arial, sans-serif; background-color: #f1f8e9; color: #33691e; } .content-container { background-color: #dcedc8; padding: 5px; border-radius: 5px; max-width: auto; margin: 20px auto; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); position: relative; } .header { background-color: #7cb342; color: #ffffff; text-align: center; padding: 20px; border-radius: 10px; margin-bottom: 20px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); position: relative; } .header h1 { margin: 0; font-size: 28px; } /* Hamburger Menu Icon */ .hamburger { position: absolute; top: 8px; left: 8px; z-index: 1000; width: 20px; height: 15px; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; } .hamburger-line { height: 3px; background-color: #fff; border-radius: 2px; } /* Sidebar (Question Nav) */ #questionNavOverlay { position: fixed; top: 0; left: -250px; /* hidden by default */ width: 250px; height: 100%; background-color: #fff; transition: left 0.3s ease-in-out; z-index: 2000; box-shadow: 2px 0 6px rgba(0,0,0,0.3); padding: 20px; overflow-y: auto; } #questionNavOverlay.show { left: 0; /* slide in */ } #questionNavTitle { margin-bottom: 10px; font-weight: bold; font-size: 1.1rem; } .question-nav { display: flex; flex-wrap: wrap; gap: 5px; } .circle-number { width: 30px; height: 30px; border-radius: 50%; background-color: #ccc; color: #000; display: flex; justify-content: center; align-items: center; cursor: pointer; user-select: none; /* Prevent text selection */ transition: background-color 0.2s; } .circle-number:hover { background-color: #aaa; } .circle-number.active { background-color: #4CAF50; color: #fff; } /* Quiz Container */ .quiz-container { background-color: #fff; border-radius: 10px; padding: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); max-width: auto; width: 100%; margin: 0 auto; text-align: center; position: relative; } .question-counter { font-weight: bold; padding: 5px 10px; border-radius: 5px; background-color: #d9edf7; position: absolute; top: 10px; left: 10px; } /* Timer display */ .timer { font-weight: bold; padding: 5px 10px; border-radius: 5px; background-color: #ffcccb; position: absolute; top: 10px; right: 10px; } .question { font-size: 1.2rem; margin-top: 40px; margin-bottom: 20px; text-align: left; } .choices { display: flex; flex-direction: column; gap: 10px; } .choice { padding: 10px; background-color: #f0f0f0; border: 1px solid #ddd; border-radius: 5px; cursor: pointer; transition: background-color 0.3s, box-shadow 0.3s; } .choice:hover { background-color: #e0e0e0; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } .choice.selected { background-color: #28a745; /* More vivid green */ color: #fff; } .choice.correct { background-color: #28a745; /* More vivid green */ border-color: #28a745; color: #fff; } .choice.incorrect { background-color: #dc3545; /* More vivid red */ border-color: #dc3545; color: #fff; } .choice.disabled { cursor: not-allowed; pointer-events: none; opacity: 0.6; } .explanation { margin-top: 20px; text-align: left; background-color: #e7f3fe; padding: 15px; border-left: 5px solid #2196F3; border-radius: 5px; } .buttons { display: flex; justify-content: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; } .btn { flex: 1 1 auto; padding: 8px 12px; background-color: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer; font-size: 0.9rem; text-align: center; min-width: 100px; max-width: 150px; transition: none; } .btn.disabled { background-color: #cccccc; cursor: not-allowed; } .hidden { display: none; } /* Result Section */ #resultContent { text-align: center; margin-top: 20px; } .congrats { font-size: 1.5rem; color: #4CAF50; } .sad { font-size: 1.5rem; color: #d32f2f; } /* Popup Message (Optional) */ #popupMessage { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); color: white; padding: 10px 20px; border-radius: 5px; font-size: 1rem; z-index: 5000; display: none; } #popupMessage.show { display: block; } #popupMessage.correct { background-color: #28a745; } #popupMessage.incorrect { background-color: #dc3545; } Current Affairs Quiz on National Events- January, 2025 Questions 1/3 Time: 00:00 Loading question... Previous Submit Answer Next Quiz Completed /***** JavaScript Code *****/ // Quiz data (sample) const quizData =[ { "question": "क्रिकेट ऑस्ट्रेलिया (CA) द्वारा घोषित 2024 की सर्वश्रेष्ठ टेस्ट टीम का कप्तान किसे चुना गया है?", "options": [ "पैट कमिंस", "रोहित शर्मा", "जसप्रीत बुमराह", "केन विलियमसन" ], "correct": 2, "explanation": "भारतीय तेज गेंदबाज जसप्रीत बुमराह को क्रिकेट ऑस्ट्रेलिया (CA) द्वारा 2024 की साल की सर्वश्रेष्ठ टेस्ट टीम का कप्तान चुना गया है। भारतीय युवा सलामी बल्लेबाज यशस्वी जायसवाल को भी टीम में शामिल किया गया है।" }, { "question": "78वीं संतोष ट्रॉफी 2024-25 का खिताब किस टीम ने जीता?", "options": [ "केरल", "गोवा", "सर्विसेज", "पश्चिम बंगाल" ], "correct": 3, "explanation": "पश्चिम बंगाल ने फाइनल में केरल को 1-0 से हराकर 78वीं संतोष ट्रॉफी 2024-25 का खिताब जीता। यह बंगाल का 33वां रिकॉर्ड खिताब है। फाइनल में निर्णायक गोल और टूर्नामेंट के सर्वश्रेष्ठ खिलाड़ी का पुरस्कार रोबी हांसदा को मिला।" }, { "question": "विश्व ब्लिट्ज शतरंज चैंपियनशिप 2024 के ओपन वर्ग का खिताब किन दो खिलाड़ियों ने संयुक्त रूप से जीता?", "options": [ "डी गुकेश और आर प्रज्ञानंधा", "मैग्नस कार्लसन और इयान नेपोम्नियाची", "हिकारू नाकामुरा और फैबियानो कारूआना", "मैग्नस कार्लसन और डी गुकेश" ], "correct": 1, "explanation": "विश्व ब्लिट्ज शतरंज चैंपियनशिप 2024 में, मैग्नस कार्लसन और इयान नेपोम्नियाची ने सडन डेथ के बाद संयुक्त रूप से ओपन वर्ग का खिताब साझा किया। यह पहली बार था जब टूर्नामेंट का खिताब साझा हुआ।" }, { "question": "राष्ट्रीय खेल पुरस्कार 2025 में मेजर ध्यानचंद खेल रत्न पुरस्कार से किसे सम्मानित नहीं किया गया?", "options": [ "गुकेश डी (शतरंज)", "हरमनप्रीत सिंह (हॉकी)", "मनु भाकर (निशानेबाजी)", "अनु रानी (एथलेटिक्स)" ], "correct": 3, "explanation": "राष्ट्रीय खेल पुरस्कार 2025 में चार खिलाड़ियों को मेजर ध्यानचंद खेल रत्न पुरस्कार मिला: गुकेश डी (शतरंज), हरमनप्रीत सिंह (हॉकी), प्रवीण कुमार (पैरा-एथलेटिक्स), और मनु भाकर (निशानेबाजी)। अनु रानी को अर्जुन पुरस्कार मिला।" }, { "question": "खो-खो विश्व कप 2025 के शुभंकर (mascot) क्या थे?", "options": [ "शेरा और रानी", "जीतू और जया", "तेजस और तारा", "वीर और वीरा" ], "correct": 2, "explanation": "नई दिल्ली में आयोजित खो-खो विश्व कप 2025 का शुभंकर हिरणों की जोड़ी 'तेजस' और 'तारा' थी। तेजस ऊर्जा का प्रतीक है और तारा मार्गदर्शन और आकांक्षा का प्रतीक है।" }, { "question": "ब्रिस्बेन इंटरनेशनल 2024 में महिला एकल वर्ग का खिताब किसने जीता?", "options": [ "एलेना रयबाकिना", "इगा स्वोटेक", "आर्यना सबालेंका", "नाओमी ओसाका" ], "correct": 2, "explanation": "ब्रिस्बेन इंटरनेशनल 2024 के महिला एकल वर्ग के फाइनल में बेलारूस की आर्यना सबालेंका ने रूस की पोलिना कुदरमेतोवा को हराकर खिताब जीता। यह उनका 18वां करियर खिताब था।" }, { "question": "AFC एशियन कप 2027 की मेजबानी कौन सा देश करेगा?", "options": [ "कतर", "जापान", "सऊदी अरब", "दक्षिण कोरिया" ], "correct": 2, "explanation": "AFC एशियन कप 2027 का आयोजन सऊदी अरब में किया जाएगा। यह पहली बार है जब सऊदी अरब इस प्रतिष्ठित फुटबॉल टूर्नामेंट की मेजबानी करेगा। मैच रियाद, जेद्दा, और अल खोबर में होंगे।" }, { "question": "मुंबई मैराथन 2025 के लिए अंतर्राष्ट्रीय एम्बेसडर किसे बनाया गया?", "options": [ "उसेन बोल्ट", "मो फराह", "कार्ल लुईस", "एलियुड किपचोगे" ], "correct": 1, "explanation": "ग्रेट ब्रिटेन के 4 बार के ओलंपिक और 6 बार के विश्व चैंपियन धावक मो फराह को मुंबई मैराथन 2025 का अंतर्राष्ट्रीय एम्बेसडर बनाया गया है।" }, { "question": "अमेरिकी पत्रिका 'ट्रैक एंड फील्ड न्यूज' ने 2024 का सर्वश्रेष्ठ पुरुष भाला फेंक एथलीट किसे घोषित किया?", "options": [ "एंडरसन पीटर्स", "जूलियन वेबर", "अरशद नदीम", "नीरज चोपड़ा" ], "correct": 3, "explanation": "अमेरिकी पत्रिका 'ट्रैक एंड फील्ड न्यूज' ने भारत के नीरज चोपड़ा को लगातार दूसरी बार (2023, 2024) वर्ष का सर्वश्रेष्ठ पुरुष भाला फेंक एथलीट घोषित किया है।" }, { "question": "किस भारतीय महिला क्रिकेटर ने आयरलैंड के खिलाफ 70 गेंदों में भारत की ओर से सबसे तेज वनडे शतक जड़ा?", "options": [ "हरमनप्रीत कौर", "स्मृति मंधाना", "शैफाली वर्मा", "जेमिमा रोड्रिग्स" ], "correct": 1, "explanation": "भारतीय महिला क्रिकेट टीम की कप्तान स्मृति मंधाना ने आयरलैंड के खिलाफ 70 गेंदों में शतक जड़कर भारत की ओर से सबसे तेज वनडे शतक का रिकॉर्ड बनाया। भारत ने यह मैच 304 रनों से जीता, जो उनकी सबसे बड़ी वनडे जीत है।" }, { "question": "38वें राष्ट्रीय खेलों का आयोजन किस राज्य में किया जा रहा है?", "options": [ "गोवा", "उत्तर प्रदेश", "उत्तराखंड", "पंजाब" ], "correct": 2, "explanation": "38वें राष्ट्रीय खेलों का आयोजन 28 जनवरी से 14 फरवरी, 2025 तक उत्तराखंड के विभिन्न शहरों जैसे देहरादून, ऋषिकेश, हल्द्वानी आदि में किया जा रहा है।" }, { "question": "इंडिया ओपन बैडमिंटन 2025 में पुरुष सिंगल्स का खिताब किसने जीता?", "options": [ "लक्ष्य सेन", "एच.एस. प्रणॉय", "विक्टर एक्सेलसन", "ली चोंग वेई" ], "correct": 2, "explanation": "नई दिल्ली में आयोजित इंडिया ओपन बैडमिंटन 2025 में पुरुष सिंगल्स का खिताब डेनमार्क के विक्टर एक्सेलसन ने जीता। उन्होंने फाइनल में हांगकांग के सी. यिउ ली को हराया।" }, { "question": "टाटा मुंबई मैराथन 2025 में पुरुष एलीट रेस का खिताब किसने जीता?", "options": [ "एलियुड किपचोगे (केन्या)", "बेर्हाने टेस्फे (एरिट्रिया)", "केनेनिसा बेकेले (इथियोपिया)", "मो फराह (ग्रेट ब्रिटेन)" ], "correct": 1, "explanation": "टाटा मुंबई मैराथन 2025 के 20वें संस्करण में, पुरुष एलीट रेस का खिताब एरिट्रिया के बेर्हाने टेस्फे ने जीता, जबकि महिला एलीट रेस केन्या की जॉयस चेपकेमोई टेले ने जीती।" }, { "question": "खो-खो विश्व कप 2025 में पुरुष और महिला दोनों वर्गों का खिताब किस देश ने जीता?", "options": [ "नेपाल", "बांग्लादेश", "श्रीलंका", "भारत" ], "correct": 3, "explanation": "भारत ने खो-खो विश्व कप 2025 में शानदार प्रदर्शन करते हुए पुरुष और महिला दोनों वर्गों में खिताब जीता। दोनों ही फाइनल में भारत ने नेपाल को हराया।" }, { "question": "18 वर्षीय डी गुकेश फिडे रैंकिंग में किस खिलाड़ी को पीछे छोड़कर भारत के नंबर 1 शतरंज खिलाड़ी बने?", "options": [ "विश्वनाथन आनंद", "पेंटाला हरिकृष्णा", "अर्जुन एरिगेसी", "आर. प्रज्ञानंधा" ], "correct": 2, "explanation": "18 वर्षीय डी गुकेश टाटा स्टील टूर्नामेंट में जीत के साथ 2784 रेटिंग अंकों तक पहुंच गए और अर्जुन एरिगेसी (2779.5) को पीछे छोड़कर फिडे रैंकिंग में भारत के नंबर 1 शतरंज खिलाड़ी बन गए।" }, { "question": "अंतर्राष्ट्रीय क्रिकेट परिषद (ICC) के अध्यक्ष जय शाह को किस प्रतिष्ठित क्रिकेट क्लब के सलाहकार बोर्ड का सदस्य चुना गया है?", "options": [ "रॉयल चैलेंजर्स क्लब", "सिडनी क्रिकेट क्लब", "मेरिलबोन क्रिकेट क्लब (MCC)", "लॉर्ड्स क्रिकेट ग्राउंड" ], "correct": 2, "explanation": "ICC अध्यक्ष जय शाह को मेरिलबोन क्रिकेट क्लब (MCC) एडवाइजरी बोर्ड का सदस्य चुना गया है। यह बोर्ड MCC की पुरानी वर्ल्ड क्रिकेट कमेटी का स्थान लेगा और इसका नेतृत्व कुमार संगकारा करेंगे।" }, { "question": "ऑस्ट्रेलियाई ओपन 2025 में महिला एकल का ग्रैंड स्लैम खिताब किसने जीता?", "options": [ "अरीना सबालेंका", "मैडिसन कीज", "इगा स्वोटेक", "कोको गॉफ" ], "correct": 1, "explanation": "ऑस्ट्रेलियाई ओपन 2025 के महिला एकल फाइनल में अमेरिका की मैडिसन कीज ने बेलारूस की अरीना सबालेंका को हराकर अपना पहला टेनिस ग्रैंड स्लैम खिताब जीता।" }, { "question": "ऑस्ट्रेलियाई ओपन 2025 में पुरुष एकल का खिताब जीतकर अपना तीसरा ग्रैंड स्लैम किसने जीता?", "options": [ "नोवाक जोकोविच", "कार्लोस अलकराज", "एलेक्जेंडर ज्वेरेव", "जानिक सिनर" ], "correct": 3, "explanation": "इटली के जानिक सिनर ने फाइनल में जर्मनी के एलेक्जेंडर ज्वेरेव को हराकर अपना लगातार दूसरा ऑस्ट्रेलियन ओपन और कुल तीसरा ग्रैंड स्लैम खिताब जीता।" }, { "question": "ICC द्वारा 2024 के लिए सर्वश्रेष्ठ पुरुष टेस्ट क्रिकेटर का पुरस्कार किसे दिया गया?", "options": [ "पैट कमिंस", "जसप्रीत बुमराह", "जो रूट", "रविचंद्रन अश्विन" ], "correct": 1, "explanation": "आईसीसी अवार्ड्स 2024 में, भारतीय तेज गेंदबाज जसप्रीत बुमराह को सर्वश्रेष्ठ पुरुष टेस्ट क्रिकेटर चुना गया। उन्हें वर्ष के सर्वश्रेष्ठ क्रिकेटर के लिए प्रतिष्ठित सर गारफील्ड सोबर्स ट्रॉफी भी मिली।" }, { "question": "5वें खेलो इंडिया विंटर गेम्स (KIWG) 2025 के पहले चरण में कौन सी टीम पदक तालिका में शीर्ष पर रही?", "options": [ "महाराष्ट्र", "सेना", "लद्दाख", "तमिलनाडु" ], "correct": 2, "explanation": "लेह में आयोजित 5वें खेलो इंडिया विंटर गेम्स 2025 के पहले चरण में, लद्दाख कुल 7 पदक (4 स्वर्ण) जीतकर पदक तालिका में शीर्ष पर रहा।" } ]; let currentQuestionIndex = 0; // Track current question let userAnswers = Array(quizData.length).fill(null); // Track user's answers // Timer variables let totalQuizTime = quizData.length * 30; // total seconds = 30 seconds * no. of questions let timeLeft = totalQuizTime; let timerInterval; // On page load, initialize quiz window.onload = function() { generateQuestionNav(); // Generate the question navigation circles loadQuestion(); startTimer(); // Start the countdown }; // Start the countdown timer function startTimer() { updateTimerDisplay(timeLeft); timerInterval = setInterval(() => { timeLeft--; updateTimerDisplay(timeLeft); if (timeLeft <= 0) { clearInterval(timerInterval); showResults(); // Force show results if time is up } }, 1000); } // Update timer on the screen in mm:ss format function updateTimerDisplay(seconds) { const timerEl = document.getElementById("timer"); const mins = Math.floor(seconds / 60).toString().padStart(2, '0'); const secs = (seconds % 60).toString().padStart(2, '0'); timerEl.innerText = `Time: ${mins}:${secs}`; } // Toggle the question nav when hamburger is pressed const hamburgerBtn = document.getElementById('hamburgerBtn'); hamburgerBtn.addEventListener('click', () => { document.getElementById('questionNavOverlay').classList.toggle('show'); }); // Close hamburger menu if user clicks outside the nav and menu document.addEventListener('click', (e) => { const navOverlay = document.getElementById('questionNavOverlay'); const hamburger = document.getElementById('hamburgerBtn'); // If the menu is open, and the click is outside both the overlay and the hamburger, close it if ( navOverlay.classList.contains('show') && !navOverlay.contains(e.target) && !hamburger.contains(e.target) ) { navOverlay.classList.remove('show'); } }); // Create small clickable circles for each question function generateQuestionNav() { const navContainer = document.getElementById("questionNav"); navContainer.innerHTML = ""; // clear old items if any quizData.forEach((_, index) => { const circle = document.createElement("div"); circle.classList.add("circle-number"); circle.innerText = index + 1; // Show question number (1-based) circle.onclick = () => jumpToQuestion(index); navContainer.appendChild(circle); }); } // Jump to a specific question function jumpToQuestion(qIndex) { currentQuestionIndex = qIndex; // Hide the nav on mobile after selection document.getElementById('questionNavOverlay').classList.remove('show'); // Reset submission/next button state document.getElementById("submitAnswerButton").classList.remove("hidden"); document.getElementById("nextButton").classList.add("hidden"); loadQuestion(); } // Load current question function loadQuestion() { highlightCurrentCircle(); // Hide explanation area and Next button initially document.getElementById("explanation").classList.add("hidden"); document.getElementById("nextButton").classList.add("hidden"); const questionData = quizData[currentQuestionIndex]; document.getElementById("question").innerText = questionData.question; document.getElementById("questionCounter").innerText = `${currentQuestionIndex + 1}/${quizData.length}`; // Clear old choices const choicesContainer = document.getElementById("choices"); choicesContainer.innerHTML = ""; // Populate choices questionData.options.forEach((option, index) => { const choiceElement = document.createElement("div"); choiceElement.className = "choice"; choiceElement.innerText = option; // If previously selected, mark it if (userAnswers[currentQuestionIndex] === index) { choiceElement.classList.add("selected"); } // On clicking a choice choiceElement.onclick = () => { // Clear all selections first document.querySelectorAll(".choice").forEach(c => c.classList.remove("selected")); // Mark this one as selected choiceElement.classList.add("selected"); userAnswers[currentQuestionIndex] = index; }; choicesContainer.appendChild(choiceElement); }); // Handle Previous button visibility document.getElementById("prevButton").style.display = currentQuestionIndex === 0 ? "none" : "inline-block"; } // Highlight the current question circle function highlightCurrentCircle() { const circles = document.querySelectorAll(".circle-number"); circles.forEach((circle, idx) => { circle.classList.remove("active"); if (idx === currentQuestionIndex) { circle.classList.add("active"); } }); } // Submit the current question's answer function submitAnswer() { const questionData = quizData[currentQuestionIndex]; const userAnswer = userAnswers[currentQuestionIndex]; // Show the explanation div const explanationDiv = document.getElementById("explanation"); explanationDiv.classList.remove("hidden"); // Clear previous correctness classes and disable further selection document.querySelectorAll(".choice").forEach((c) => { c.classList.add("disabled"); c.onclick = null; }); // Determine correctness or skipping if (userAnswer === null) { explanationDiv.innerHTML = "You Skipped the question.<br/><br/>व्याख्या: " + questionData.explanation; showPopupMessage("You Skipped the question", false); } else if (userAnswer === questionData.correct) { explanationDiv.innerHTML = "You got it right!<br/><br/>व्याख्या: " + questionData.explanation; showPopupMessage("You got it right", true); // Highlight correct choice document.querySelectorAll(".choice")[userAnswer].classList.add("correct"); } else { explanationDiv.innerHTML = "You got it wrong.<br/><br/>व्याख्या: " + questionData.explanation; showPopupMessage("You got it wrong", false); // Highlight correct choice document.querySelectorAll(".choice")[questionData.correct].classList.add("correct"); // Mark the chosen one as incorrect document.querySelectorAll(".choice")[userAnswer].classList.add("incorrect"); } // Hide the submit button, show the next button document.getElementById("submitAnswerButton").classList.add("hidden"); document.getElementById("nextButton").classList.remove("hidden"); } // Go to the next question or show final results function nextQuestion() { currentQuestionIndex++; if (currentQuestionIndex >= quizData.length) { // Show results if no more questions showResults(); } else { // Reset buttons document.getElementById("submitAnswerButton").classList.remove("hidden"); document.getElementById("nextButton").classList.add("hidden"); loadQuestion(); } } // Go to the previous question function previousQuestion() { if (currentQuestionIndex > 0) { currentQuestionIndex--; document.getElementById("submitAnswerButton").classList.remove("hidden"); document.getElementById("nextButton").classList.add("hidden"); loadQuestion(); } } // Show final quiz results function showResults() { // Stop the timer if it's still running clearInterval(timerInterval); // Calculate correct answers const correctAnswersCount = userAnswers.filter( (ans, i) => ans === quizData[i].correct ).length; // Hide quiz content document.getElementById("quizContent").classList.add("hidden"); // Show results document.getElementById("resultContent").classList.remove("hidden"); const percentage = (correctAnswersCount / quizData.length) * 100; let resultHTML = ""; if (percentage >= 60) { resultHTML = `<div class="congrats">🎉 बधाई हो! आपने ${percentage.toFixed( 2 )}% स्कोर किया है!</div>`; } else { resultHTML = `<div class="sad">😢 आपने ${percentage.toFixed( 2 )}% स्कोर किया है। अगली बार के लिए शुभकामनाएं!</div>`; } document.getElementById("resultMessage").innerHTML = resultHTML; document.getElementById("scoreMessage").innerText = `आपने कुल ${quizData.length} में से ${correctAnswersCount} प्रश्न सही उत्तर दिए हैं।`; } // Optional popup message function showPopupMessage(message, isCorrect) { const popup = document.getElementById('popupMessage'); popup.innerText = message; popup.className = ''; popup.classList.add('show'); popup.classList.add(isCorrect ? 'correct' : 'incorrect'); setTimeout(() => { popup.classList.remove('show'); popup.classList.add('hidden'); }, 2000); } // Button event listeners document.getElementById('prevButton').addEventListener('click', previousQuestion); document.getElementById('submitAnswerButton').addEventListener('click', submitAnswer); document.getElementById('nextButton').addEventListener('click', nextQuestion); // Predefined Darker Color Themes const themes = [ { header: '#a31645', headerText: '#ffffff', container: '#e8c4d6', containerText: '#6e0c36', headings: '#6e0c36' }, // Berry Delight { header: '#00574b', headerText: '#ffffff', container: '#b3dfd7', containerText: '#00382e', headings: '#00382e' }, // Ocean Breeze { header: '#c95a00', headerText: '#ffffff', container: '#dca865', containerText: '#7a3400', headings: '#7a3400' }, // Sunset Glow { header: '#4a0f6f', headerText: '#ffffff', container: '#cdb5e3', containerText: '#320b4a', headings: '#320b4a' }, // Calming Lavender { header: '#1e4d2b', headerText: '#ffffff', container: '#98c1a3', containerText: '#122417', headings: '#122417' }, // Forest Retreat { header: '#c99800', headerText: '#ffffff', container: '#e8d18a', containerText: '#6c4f00', headings: '#6c4f00' }, // Golden Elegance { header: '#01477e', headerText: '#ffffff', container: '#86b9e4', containerText: '#00223d', headings: '#00223d' }, // Sky Calm { header: '#5a3b2e', headerText: '#ffffff', container: '#b8a89c', containerText: '#32211a', headings: '#32211a' }, // Retro Rust { header: '#b34727', headerText: '#ffffff', container: '#f2c29d', containerText: '#6a2915', headings: '#6a2915' }, // Warm Peach { header: '#0f4c43', headerText: '#ffffff', container: '#92c3b8', containerText: '#072822', headings: '#072822' }, // Cool Mint ]; // Apply Random Darker Theme function applyRandomTheme() { const header = document.querySelector('.header'); const container = document.querySelector('.content-container'); const headings = document.querySelectorAll('.content-container h2'); // Select a random theme const randomTheme = themes[Math.floor(Math.random() * themes.length)]; // Apply Header Colors header.style.backgroundColor = randomTheme.header; header.style.color = randomTheme.headerText; // Apply Container Colors container.style.backgroundColor = randomTheme.container; container.style.color = randomTheme.containerText; // Apply Heading Colors headings.forEach((heading) => { heading.style.color = randomTheme.headings; heading.style.borderBottom = `2px solid ${randomTheme.headings}`; }); } // Apply the theme on page load window.onload = function () { applyRandomTheme(); // Set random theme generateQuestionNav(); // Generate question navigation loadQuestion(); // Load the first question startTimer(); // Start the countdown timer };