Skip to content

Node.js based forum software built for the modern web

Merge remote-tracking branch 'origin/master'

barisusakli5fa6686112c5
diff --cc public/src/modules/navigator.js
index 89bfc737ee,73ea9b8946..6877abe8db
--- a/public/src/modules/navigator.js
+++ b/public/src/modules/navigator.js
@@@ -121,20 -118,11 +121,19 @@@ define('navigator', ['forum/pagination'
}
});
- // If a threshold is undefined, try to determine one based on new index
- if (threshold === undefined && ajaxify.currentPage.startsWith('topic')) {
- var anchorEl = components.get('post/anchor', index - 1),
- anchorRect = anchorEl.get(0).getBoundingClientRect();
+ // check if we are at the top
+ if (scrollTop === 0 && parseInt(els.first().attr('data-index'), 10) === 0) {
+ index = 1;
+ // check if we are near the bottom
+ } else if (scrollTop + windowHeight > documentHeight - 100 && parseInt(els.last().attr('data-index'), 10) === count - 1) {
+ index = count;
+ }
+
+ // If a threshold is undefined, try to determine one based on new index
+ if (threshold === undefined) {
+ var anchorEl = components.get('post/anchor', index - 1);
+ var anchorRect = anchorEl.get(0).getBoundingClientRect();
-
threshold = anchorRect.top;
}