From 4cd9081dc3a41594174480c1565fd2427550c50a Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 15 Mar 2024 17:36:55 +0100 Subject: reduce memory usage & fix scroll to top --- static/script.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'static/script.js') diff --git a/static/script.js b/static/script.js index 639e743..10db48c 100644 --- a/static/script.js +++ b/static/script.js @@ -37,6 +37,10 @@ function display_example(i) { } } +function scrollTop() { + window.scrollTo(0, 0); +} + function spacebar() { if (revealed) { console.log("Next item"); @@ -46,5 +50,5 @@ function spacebar() { $("#gen_section").removeClass("gen_hidden"); revealed = true; } - window.scrollTo(0, 0); + window.setTimeout(scrollTop, 1); } -- cgit v1.2.3