diff --git a/Pages/Quizes/tests/button-1/index.html b/Pages/Quizes/tests/button-1/index.html index e30be2cf9..7e0081393 100644 --- a/Pages/Quizes/tests/button-1/index.html +++ b/Pages/Quizes/tests/button-1/index.html @@ -45,6 +45,9 @@

P Block

+
+
+
diff --git a/Pages/Quizes/tests/button-1/script.js b/Pages/Quizes/tests/button-1/script.js index 483aa1dfd..b6934e130 100644 --- a/Pages/Quizes/tests/button-1/script.js +++ b/Pages/Quizes/tests/button-1/script.js @@ -112,11 +112,25 @@ const quizData = [ const submitButton = document.getElementById("submit"); const difficulty = document.getElementById("difficulty"); const quizcount = document.getElementById("quizcount"); + const prev_score= document.getElementById("max-score"); - + let currentQuiz = 0; let score = 0; const weak_topics=[]; + const loadScore=()=>{ + const score= localStorage.getItem('btn-1-max'); + if(score){ + prev_score.innerHTML=`Max score
${score}`; + } + + } + const storeMax=(score)=>{ + const maxscore = localStorage.getItem('btn-1-max'); + if (score>maxscore){ + localStorage.setItem('btn-1-max',score) + } + } const deselectAnswers = () => { answerElements.forEach((answer) => (answer.checked = false)); @@ -132,6 +146,7 @@ const quizData = [ const loadQuiz = () => { deselectAnswers(); + const currentQuizData = quizData[currentQuiz]; questionElement.innerText = currentQuizData.question; a_text.innerText = currentQuizData.a; @@ -143,7 +158,7 @@ const quizData = [ }; loadQuiz(); - + loadScore(); submitButton.addEventListener("click", () => { const answer = getSelected(); if (answer) { @@ -161,6 +176,8 @@ const quizData = [

You answered ${score}/${quizData.length} questions correctly

` + storeMax(score); + loadScore(); var temp; for (i = 0; i < weak_topics.length; i++) { diff --git a/Pages/Quizes/tests/button-1/style.css b/Pages/Quizes/tests/button-1/style.css index bf21138f3..8ad5028c1 100644 --- a/Pages/Quizes/tests/button-1/style.css +++ b/Pages/Quizes/tests/button-1/style.css @@ -334,6 +334,23 @@ ul { margin-left: 1.5vw; } /* footer */ +.max-wrapper{ + background-color:#F0F1FF; + border-radius: 50%; + width:100px; + height:100px; + display: flex; + justify-content:center; + align-items: center; + border : 7px solid #242969; + margin-bottom: 20px; + padding: 5px; +} +#max-score{ + font-family: 'Poppins', sans-serif; + font-weight: bold; + text-align: center; +}