diff --git a/public/src/client/category.js b/public/src/client/category.js index cfb7de08d1..634317a21c 100644 --- a/public/src/client/category.js +++ b/public/src/client/category.js @@ -14,7 +14,7 @@ define('forum/category', [ $(window).on('action:ajaxify.start', function(ev, data) { if (ajaxify.currentPage !== data.url) { - navigator.hide(); + navigator.disable(); removeListeners(); } @@ -39,12 +39,12 @@ define('forum/category', [ sort.handleSort('categoryTopicSort', 'user.setCategorySort', 'category/' + ajaxify.data.slug); - enableInfiniteLoadingOrPagination(); - if (!config.usePagination) { navigator.init('[component="category/topic"]', ajaxify.data.topic_count, Category.toTop, Category.toBottom, Category.navigatorCallback); } + enableInfiniteLoadingOrPagination(); + $('[component="category"]').on('click', '[component="topic/header"]', function() { var clickedIndex = $(this).parents('[data-index]').attr('data-index'); $('[component="category/topic"]').each(function(index, el) { @@ -173,7 +173,7 @@ define('forum/category', [ if (!config.usePagination) { infinitescroll.init($('[component="category"]'), Category.loadMoreTopics); } else { - navigator.hide(); + navigator.disable(); } } diff --git a/public/src/client/topic.js b/public/src/client/topic.js index eb235b2488..faaaddbf00 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -19,7 +19,7 @@ define('forum/topic', [ $(window).on('action:ajaxify.start', function(ev, data) { if (ajaxify.currentPage !== data.url) { - navigator.hide(); + navigator.disable(); components.get('navbar/title').find('span').text('').hide(); app.removeAlert('bookmark'); @@ -216,7 +216,7 @@ define('forum/topic', [ if (!config.usePagination) { infinitescroll.init($('[component="topic"]'), posts.loadMorePosts); } else { - navigator.hide(); + navigator.disable(); } } diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index c9275348f3..6a72ef89ea 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -18,7 +18,7 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com toTop = toTop || function() {}; toBottom = toBottom || function() {}; - $(window).on('scroll', navigator.update); + $(window).off('scroll', navigator.update).on('scroll', navigator.update); $('.pagination-block .dropdown-menu').off('click').on('click', function(e) { e.stopPropagation(); @@ -74,7 +74,12 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com toggle(true); }; - navigator.hide = function() { + navigator.disable = function() { + count = 0; + index = 1; + navigator.selector = navigator.callback = null; + $(window).off('scroll', navigator.update); + toggle(false); };