summaryrefslogtreecommitdiff
path: root/js/Headlines.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-18 15:40:54 +0300
committerAndrew Dolgov <[email protected]>2021-02-18 15:40:54 +0300
commit61fdce4f44fb9c210c19648d73c39ab9854703d2 (patch)
treeeb774a810713ab223e48a008670a1a62a3e845c3 /js/Headlines.js
parent2c5927d8cdc6f16f8e8f86df201e625159e746ce (diff)
rework previous to be even less jumpy
Diffstat (limited to 'js/Headlines.js')
-rwxr-xr-xjs/Headlines.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/js/Headlines.js b/js/Headlines.js
index b10680cfe..128a7e571 100755
--- a/js/Headlines.js
+++ b/js/Headlines.js
@@ -929,14 +929,18 @@ const Headlines = {
} else if (App.isCombinedMode()) {
// try to show hsp if no next article exists, in case there's useful information like first_id_changed etc
const row = $("RROW-" + current_id);
+ const ctr = $("headlines-frame");
if (row) {
const next = row.nextSibling;
// hsp has half-screen height in auto catchup mode therefore we use its first child (normally A element)
if (next && Element.visible(next) && next.id == "headlines-spacer" && next.firstChild) {
- $("headlines-frame").scrollTop = $("headlines-spacer").offsetTop -
- $("headlines-frame").offsetHeight + next.firstChild.offsetHeight;
+ const offset = $("headlines-spacer").offsetTop - $("headlines-frame").offsetHeight + next.firstChild.offsetHeight;
+
+ // don't jump back either
+ if (ctr.scrollTop < offset)
+ ctr.scrollTop = offset;
}
}
}