Less sensitive auto-scroll

This commit is contained in:
Daniel O'Connell
2023-11-29 12:27:57 +01:00
parent 8332cda637
commit 2920f739a5
+6 -6
View File
@@ -37,15 +37,15 @@ type State =
response: AssistantEntryType;
};
// smooth-scroll to the bottom of the window if we're already less than 30% a screen away
// smooth-scroll to the bottom of the window if we're already less than 10% a screen away
// note: finicky interaction with "smooth" - maybe fix later.
function scroll30() {
if (
document.documentElement.scrollHeight - window.scrollY >
window.innerHeight * 1.3
)
return;
window.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" });
document.documentElement.scrollHeight - window.scrollY <
window.innerHeight * 1.1
) {
window.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" });
}
}
const randomQuestion = () =>