diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 229b3b313c..dcb85f203a 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -84,7 +84,7 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT if (config.topicPostSort !== 'oldest_to_newest') { postCount = 1; } - navigator.scrollBottom(postCount); + navigator.scrollBottom(postCount - 1); }); }; diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index 0d62b52b00..232115f8da 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -112,13 +112,13 @@ define('navigator', ['forum/pagination'], function(pagination) { navigator.scrollUp = function () { $('body,html').animate({ - scrollTop: $('body').scrollTop() - $(window).height() + scrollTop: $(window).scrollTop() - $(window).height() }); }; navigator.scrollDown = function () { $('body,html').animate({ - scrollTop: $('body').scrollTop() + $(window).height() + scrollTop: $(window).scrollTop() + $(window).height() }); }; @@ -131,6 +131,9 @@ define('navigator', ['forum/pagination'], function(pagination) { }; navigator.scrollBottom = function(index) { + if (parseInt(index, 10) < 0) { + return; + } if ($('li[data-index="' + index + '"]').length) { navigator.scrollToPost(index, true); } else {