Skip to content

Commit

Permalink
scroll to top when showing results
Browse files Browse the repository at this point in the history
  • Loading branch information
glendc committed Feb 11, 2024
1 parent 9b0c17b commit 89ad7cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions site/1/mathbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ <h3 id="exercise-feedback">&nbsp;</h3>
document.getElementById("page-exercises").hidden = true;
document.getElementById("page-result").hidden = false;

document.getElementsByTagName("main").scrollTo({
behavior: "smooth",
});

const score = window.mathBoxState.exerciseCount - window.mathBoxState.wrongExerciseCount;
const total = window.mathBoxState.exerciseCount;

Expand Down
6 changes: 5 additions & 1 deletion site/1/thermometer.html
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ <h3 id="exercise-feedback">&nbsp;</h3>
document.getElementById("page-exercises").hidden = true;
document.getElementById("page-result").hidden = false;

document.getElementsByTagName("main").scrollTo({
behavior: "smooth",
});

const score = window.thermomterState.exerciseCount - window.thermomterState.wrongExerciseCount;
const total = window.thermomterState.exerciseCount;

Expand Down Expand Up @@ -603,7 +607,7 @@ <h3 id="exercise-feedback">&nbsp;</h3>

document.getElementById("exercise").scrollTo({
behavior: "smooth",
})
});
}

function validateAnswer() {
Expand Down

0 comments on commit 89ad7cd

Please sign in to comment.