From ce9a3f20c5a49628fa10aa19e8eee27496c32fb9 Mon Sep 17 00:00:00 2001 From: RoiEX Date: Tue, 5 Sep 2017 22:41:40 +0200 Subject: [PATCH] Optimize transition --- public/src/modules/navigator.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index df5621f287..2f2a79a05a 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -4,7 +4,7 @@ define('navigator', ['forum/pagination', 'components'], function (pagination, co var navigator = {}; var index = 1; var count = 0; - var navigatorUpdateTimeoutId = 0; + var navigatorUpdateTimeoutId = undefined; navigator.scrollActive = false; @@ -91,11 +91,12 @@ define('navigator', ['forum/pagination', 'components'], function (pagination, co } navigator.delayedUpdate = function () { - if (navigatorUpdateTimeoutId) { - clearTimeout(navigatorUpdateTimeoutId); - navigatorUpdateTimeoutId = 0; + if (!navigatorUpdateTimeoutId) { + navigatorUpdateTimeoutId = setTimeout(function () { + navigator.update(); + navigatorUpdateTimeoutId = undefined; + }, 100); } - navigatorUpdateTimeoutId = setTimeout(navigator.update, 100); }; navigator.update = function (threshold) { @@ -165,7 +166,9 @@ define('navigator', ['forum/pagination', 'components'], function (pagination, co index = index > count ? count : index; $('.pagination-block .pagination-text').translateHtml('[[global:pagination.out_of, ' + index + ', ' + count + ']]'); - $('.pagination-block .progress-bar').width(($(window).scrollTop() / ($(document).height() - $(window).height()) * 100) + '%'); + var fraction = $(window).scrollTop() / ($(document).height() - $(window).height()); + $('.pagination-block meter').val(fraction); + $('.pagination-block .progress-bar').width((fraction * 100) + '%'); }; navigator.scrollUp = function () {