diff options
| author | 2014-09-16 17:23:25 +0200 | |
|---|---|---|
| committer | 2014-09-16 17:23:25 +0200 | |
| commit | 7eb71edecf0b4eb6018bc10bcffc2441996489d3 (patch) | |
| tree | 656c1a6445af347f71bd6a6bc49bb8985acc0bb1 /p | |
| parent | 4fd3babcb66556e53315dd46aea798e12fba3614 (diff) | |
Improve align article on previous article
Always align view on previous article IF its top is not too far (magic
number: 150px).
See https://github.com/marienfressinaud/FreshRSS/issues/470
Diffstat (limited to 'p')
| -rw-r--r-- | p/scripts/main.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index 69ac01816..7c3be3af4 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -251,9 +251,14 @@ function toggleContent(new_active, old_active) { } if (sticky_post) { - var new_pos = new_active.position().top - new_active.children('.flux_header').outerHeight(), + var prev_article = new_active.prevAll('.flux'), + new_pos = new_active.position().top, old_scroll = $(box_to_move).scrollTop(); + if (prev_article.length > 0 && new_pos - prev_article.position().top <= 150) { + new_pos = prev_article.position().top; + } + if (hide_posts) { if (relative_move) { new_pos += old_scroll; |
