From: Patrick Steinhardt Date: Sat, 20 May 2017 15:35:44 +0000 (+0200) Subject: scroll: fix percent-based scrolling X-Git-Url: https://git.owens.tech/rss.xml/rss.xml/git?a=commitdiff_plain;h=1304b8cfc8408c005b37c0416013ed2148519cba;p=vimb.git scroll: fix percent-based scrolling Scrolling via ^D and ^U should scroll by a percentage of the client's current viewport. We do this in JavaScript via the client height of the document's element. Accidentally, it may hold the desired value in some cases, but in general it only holds the total height of the element itself. What we desire instead is the window's height, which can be retrieved via `Window.innerHeight`. Like this, our calculations are not based upon the webpage but instead on the browser window, fixing scrolling on some pages. --- diff --git a/src/scripts/scroll.js b/src/scripts/scroll.js index 92fc481..83e30f8 100644 --- a/src/scripts/scroll.js +++ b/src/scripts/scroll.js @@ -2,7 +2,7 @@ function vbscroll(mode, scrollStep, count) { var w = window, d = document, x = y = 0, - ph = d.documentElement.clientHeight, + ph = w.innerHeight, c = count||1, rel = true; switch (mode) {