Wait for animation frame

This commit is contained in:
Chuck Dries 2017-06-13 18:56:08 -07:00
parent 7ed9065ee9
commit cfa0a137af

View File

@ -191,15 +191,15 @@
var sp = document.getElementById("scrollprompt");
document.addEventListener("scroll", function() {
last_known_scroll = getScrollY();
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;
// 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;
});
sc(last_known_scroll);