From 21b634e03fb70c989c394945f0291df722e15740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 23 Apr 2015 14:37:27 -0400 Subject: [PATCH] closes #3081 --- public/src/modules/navigator.js | 3 ++- src/controllers/topics.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index e8d57352cb..443f404cea 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -161,7 +161,8 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com var elTop = el.offset().top; var elBottom = elTop + Math.floor(el.height()); - return (elTop >= scrollTop && elBottom <= scrollBottom) || (elTop <= scrollTop && elBottom >= scrollTop); + + return (elTop >= scrollTop && elBottom < scrollBottom) || (elTop < scrollTop && elBottom > scrollTop); } navigator.scrollToPost = function(postIndex, highlight, duration, offset) { diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 4e2ade5868..9db26b8f4f 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -89,9 +89,9 @@ topicsController.get = function(req, res, next) { } if (!settings.usePagination) { if (reverse) { - postIndex = Math.max(0, postCount - (req.params.post_index || postCount) - (settings.postsPerPage - 1)); + postIndex = Math.max(0, postCount - (req.params.post_index || postCount) - (settings.postsPerPage / 2)); } else { - postIndex = Math.max(0, (req.params.post_index || 1) - (settings.postsPerPage + 1)); + postIndex = Math.max(0, (req.params.post_index || 1) - (settings.postsPerPage / 2)); } } else if (!req.query.page) { var index = 0;