rework previous to be even less jumpy

master
Andrew Dolgov 4 years ago
parent 2c5927d8cd
commit 61fdce4f44

@ -929,14 +929,18 @@ const Headlines = {
} else if (App.isCombinedMode()) { } else if (App.isCombinedMode()) {
// try to show hsp if no next article exists, in case there's useful information like first_id_changed etc // 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 row = $("RROW-" + current_id);
const ctr = $("headlines-frame");
if (row) { if (row) {
const next = row.nextSibling; const next = row.nextSibling;
// hsp has half-screen height in auto catchup mode therefore we use its first child (normally A element) // 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) { if (next && Element.visible(next) && next.id == "headlines-spacer" && next.firstChild) {
$("headlines-frame").scrollTop = $("headlines-spacer").offsetTop - const offset = $("headlines-spacer").offsetTop - $("headlines-frame").offsetHeight + next.firstChild.offsetHeight;
$("headlines-frame").offsetHeight + next.firstChild.offsetHeight;
// don't jump back either
if (ctr.scrollTop < offset)
ctr.scrollTop = offset;
} }
} }
} }

Loading…
Cancel
Save