Add scrolling to top after test restarts (#2220) by Ferotiq

* Add scrolling to top after test restarts

* small changes

scrolling only when the previous element has finished fading out
checking if current scrollY is greater than 0

Co-authored-by: Jack <bartnikjack@gmail.com>
This commit is contained in:
Ferotiq 2021-12-28 14:34:46 -06:00 committed by GitHub
parent 9329da7862
commit 6bafb574ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -594,6 +594,7 @@ export function restart(
$("#monkey").stop(true, true).css({ animationDuration: "0s" });
$("#typingTest").css("opacity", 0).removeClass("hidden");
$("#wordsInput").val(" ");
if(window.scrollY > 0) window.scrollTo({ top: 0, behavior: "smooth" });
if (!withSameWordset) {
setRepeated(false);
setPaceRepeat(repeatWithPace);