From 1e105a64ab12b37f55b605a89e869f7bbb520e95 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 24 Feb 2014 19:51:57 -0500 Subject: Add a configuration option to get sticky articles Now the user can choose if an opened article will be repositioned to the top or not See #338 --- p/scripts/main.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index ec27bd50c..6cc992379 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -238,26 +238,28 @@ function toggleContent(new_active, old_active) { var new_pos = new_active.position().top, old_scroll = $(box_to_move).scrollTop(); - if (hide_posts) { + if (sticky_post) { + if (hide_posts) { - new_pos = new_active.position().top; - old_scroll = $(box_to_move).scrollTop(); + new_pos = new_active.position().top; + old_scroll = $(box_to_move).scrollTop(); - if (relative_move) { - new_pos += old_scroll; - } + if (relative_move) { + new_pos += old_scroll; + } - if (old_active[0] !== new_active[0]) { - new_active.children(".flux_content").first().each(function () { - $(box_to_move).scrollTop(new_pos).scrollTop(); - }); - } - } else { - if (relative_move) { - new_pos += old_scroll; - } + if (old_active[0] !== new_active[0]) { + new_active.children(".flux_content").first().each(function () { + $(box_to_move).scrollTop(new_pos).scrollTop(); + }); + } + } else { + if (relative_move) { + new_pos += old_scroll; + } - $(box_to_move).scrollTop(new_pos).scrollTop(); + $(box_to_move).scrollTop(new_pos).scrollTop(); + } } if (auto_mark_article) { -- cgit v1.2.3