aboutsummaryrefslogtreecommitdiff
path: root/p
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-04-03 23:10:33 +0200
committerGravatar GitHub <noreply@github.com> 2019-04-03 23:10:33 +0200
commit2efab9893cd0e0e115edadbd21c1bbd6b771df5b (patch)
tree0300d4aa68aecaa34d115837124b2ba317053614 /p
parent452419bf83b2b124bb05c58f48b459107595ce0a (diff)
Fix shortcut problem when showing articles unfolded (#2336)
Fix https://github.com/FreshRSS/FreshRSS/issues/2328
Diffstat (limited to 'p')
-rw-r--r--p/scripts/main.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 192d0bdf3..f22a9079b 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -365,13 +365,12 @@ function toggleContent(new_active, old_active, skipping) {
const relative_move = context.current_view === 'global',
box_to_move = relative_move ? document.getElementById('panel') : document.documentElement;
- if (context.sticky_post) {
+ if (context.sticky_post) { //Stick the article to the top when opened
let prev_article = new_active.previousElementSibling,
- new_pos = new_active.offsetTop + document.documentElement.scrollTop,
- old_scroll = box_to_move.scrollTop;
+ new_pos = new_active.offsetParent.offsetTop + new_active.offsetTop;
if (prev_article && new_active.offsetTop - prev_article.offsetTop <= 150) {
- new_pos = prev_article.offsetTop;
+ new_pos = prev_article.offsetParent.offsetTop + prev_article.offsetTop;
if (relative_move) {
new_pos -= box_to_move.offsetTop;
}
@@ -382,7 +381,7 @@ function toggleContent(new_active, old_active, skipping) {
new_pos -= document.body.clientHeight / 4;
}
if (relative_move) {
- new_pos += old_scroll;
+ new_pos += box_to_move.scrollTop;
}
box_to_move.scrollTop = new_pos;
}