Motion MCQ Challenge Class 9 Ch 7 Quiz| Test Yourself!By Bharat Muni / July 13, 2025 Graphical Representation of MotionDistance-Time & Velocity-Time Graphs Quiz View Report `; } createConfetti() { const colors = ['#f39c12', '#e74c3c', '#3498db', '#27ae60', '#9b59b6']; const confettiContainer = document.createElement('div'); confettiContainer.className = 'confetti-container'; for (let i = 0; i < 30; i++) { const confetti = document.createElement('div'); confetti.className = 'confetti'; confetti.style.left = Math.random() * 100 + '%'; confetti.style.background = colors[Math.floor(Math.random() * colors.length)]; confetti.style.animationDelay = Math.random() * 0.5 + 's'; confetti.style.animationDuration = (Math.random() * 0.5 + 1.5) + 's'; confettiContainer.appendChild(confetti); } document.body.appendChild(confettiContainer); setTimeout(() => { document.body.removeChild(confettiContainer); }, 2500); } attachEventListeners() { document.querySelectorAll('.option').forEach(button => { button.addEventListener('click', (e) => this.handleOptionClick(e)); }); const nextBtn = document.getElementById('next-btn'); if (nextBtn) nextBtn.addEventListener('click', () => this.handleNextQuestion()); const viewReportBtn = document.getElementById('view-report-btn'); if (viewReportBtn) viewReportBtn.addEventListener('click', () => this.handleViewReport()); const restartBtn = document.getElementById('restart-btn'); if (restartBtn) restartBtn.addEventListener('click', () => this.handleRestartQuiz()); } handleOptionClick(event) { if (this.isAnswerChecked) return; const optionIndex = parseInt(event.target.dataset.option); this.selectedOptionIndex = optionIndex; this.isAnswerChecked = true; const isCorrect = optionIndex === this.questions[this.currentQuestionIndex].correctAnswerIndex; this.userAnswers.push({ questionIndex: this.currentQuestionIndex, selectedOptionIndex: optionIndex, isCorrect: isCorrect, }); this._shouldShake = false; if (isCorrect) { this.createConfetti(); this.playSound('correct'); } else { this._shouldShake = true; this.playSound('wrong'); } this.render(); if (this._shouldShake) { setTimeout(() => { this._shouldShake = false; this.render(); }, 500); } } handleNextQuestion() { this.selectedOptionIndex = null; this.isAnswerChecked = false; this._shouldShake = false; if (this.currentQuestionIndex < this.questions.length - 1) { this.currentQuestionIndex++; } else { this.quizCompleted = true; } this.render(); } handleViewReport() { this.showReport = true; this.render(); } handleRestartQuiz() { this.currentQuestionIndex = 0; this.selectedOptionIndex = null; this.isAnswerChecked = false; this.userAnswers = []; this.quizCompleted = false; this.showReport = false; this._shouldShake = false; this.render(); } } document.addEventListener('DOMContentLoaded', () => { new Quiz(); }); Next > Equations of Motion Pages: 1 2 3 4 5 6 7 8
Explanation The Fundamental Unit Of Life Class 9, Essential & EngagingClass 9, Chapter Explanations, Science
Class 9 Atoms And Molecules MCQs Challenge! 120+ Topic Wise MCQs [Quiz Format]Class 9, MCQs, Quiz, Science
Crush Animal Tissues MCQ Class 9, Chapter 6 Tissues [Quiz Format]Uncategorized, Class 9, MCQs, Quiz, Science