Don't anchor scroll when the top of the page has been reached

This commit is contained in:
Toby Zerner 2015-06-11 18:40:21 +09:30
parent 914528d6c4
commit cc6113243a

View File

@ -295,7 +295,7 @@ class PostStream extends mixin(Component, evented) {
var redraw = () => { var redraw = () => {
if (start < this.visibleStart || end > this.visibleEnd) return; if (start < this.visibleStart || end > this.visibleEnd) return;
var anchorIndex = backwards ? this.visibleEnd - 1 : this.visibleStart; var anchorIndex = backwards && $(window).scrollTop() > 0 ? this.visibleEnd - 1 : this.visibleStart;
anchorScroll(this.$('.item[data-index='+anchorIndex+']'), () => m.redraw(true)); anchorScroll(this.$('.item[data-index='+anchorIndex+']'), () => m.redraw(true));
this.unpause(); this.unpause();