From cfa0a137affe7e49ba5c3c11acb969f1b7feae19 Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Tue, 13 Jun 2017 18:56:08 -0700 Subject: [PATCH] Wait for animation frame --- index.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 07ca52e..2b3378e 100644 --- a/index.html +++ b/index.html @@ -191,15 +191,15 @@ var sp = document.getElementById("scrollprompt"); document.addEventListener("scroll", function() { last_known_scroll = getScrollY(); - sc(last_known_scroll); + // sc(last_known_scroll); // Usually an important performance consideration, this ends up significantly delaying the resizing of the top box, which is important to stay sized correctly - // if (!queueing) { - // window.requestAnimationFrame(function() { - // sc(last_known_scroll); - // queueing = false; - // }); - // } - // queueing = true; + if (!queueing) { + window.requestAnimationFrame(function() { + sc(last_known_scroll); + queueing = false; + }); + } + queueing = true; }); sc(last_known_scroll);