diff --git a/js/src/forum/components/PostStream.js b/js/src/forum/components/PostStream.js index 66a8d73ea..31c9ae892 100644 --- a/js/src/forum/components/PostStream.js +++ b/js/src/forum/components/PostStream.js @@ -136,7 +136,7 @@ export default class PostStream extends Component { * * @param {Integer} top */ - onscroll(top) { + onscroll(top = window.pageYOffset) { if (this.state.paused) return; const marginTop = this.getMarginTop(); const viewportHeight = $(window).height() - marginTop; @@ -164,6 +164,14 @@ export default class PostStream extends Component { clearTimeout(this.calculatePositionTimeout); this.calculatePositionTimeout = setTimeout(this.calculatePosition.bind(this), 100); + this.updateScrubber(top); + } + + updateScrubber(top = window.pageYOffset) { + const marginTop = this.getMarginTop(); + const viewportHeight = $(window).height() - marginTop; + const viewportTop = top + marginTop; + // Before looping through all of the posts, we reset the scrollbar // properties to a 'default' state. These values reflect what would be // seen if the browser were scrolled right up to the top of the page,