From 61fdce4f44fb9c210c19648d73c39ab9854703d2 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 18 Feb 2021 15:40:54 +0300 Subject: [PATCH] rework previous to be even less jumpy --- js/Headlines.js | 8 ++++++-- 1 file 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; } } }