Skip to content

Commit

Permalink
Try to fix #8
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyEye-FAST committed Jul 11, 2024
1 parent 6f41572 commit 32ce917
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions static/js/quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ $(document).ready(function () {
$("#sourceText").text(question.source);
$("#keyText").text(currentKey);

$("#inputBox").val("").attr("maxlength", translationLength);
createBoxes(translationLength);

$("#info").fadeIn(fadeDuration);
});

$("#inputBox").val("").attr("maxlength", translationLength);
createBoxes(translationLength);
}

// 创建相应长度的 box
Expand Down Expand Up @@ -91,7 +91,10 @@ $(document).ready(function () {
const correctAnswer = questions[currentKey].translation;

if (input === correctAnswer) {
$(".box").css("background-color", "#79b851");
for (let i = 0; i < correctAnswer.length; i++) {
const box = $("#box" + (i + 1));
box.css("background-color", "#79b851");
}

if (currentQuestionIndex === questionKeys.length - 1) {
setTimeout(showSummary, delayBetweenQuestions);
Expand Down

0 comments on commit 32ce917

Please sign in to comment.