1
0
mirror of https://github.com/flarum/core.git synced 2025-08-10 18:35:56 +02:00

Use scrollToIndex to contain scrollToLast

This commit is contained in:
Alexander Skvortsov
2020-07-05 19:52:56 -04:00
committed by Franz Liedke
parent 9a357f5d19
commit 51008bc65d
2 changed files with 1 additions and 18 deletions

View File

@@ -23,9 +23,6 @@ export default class PostStream extends Component {
this.loadPageTimeouts = {};
this.pagesLoading = 0;
this.state.on('scrollToLast', () => {
this.scrollToLast();
});
this.state.on('scrollToNumber', (number, noAnimation) => {
this.scrollToNumber(number, noAnimation);
});
@@ -276,20 +273,6 @@ export default class PostStream extends Component {
return this.scrollToItem($item, noAnimation).done(this.flashItem.bind(this, $item));
}
scrollToLast() {
$('html,body')
.stop(true)
.animate(
{
scrollTop: $(document).height() - $(window).height(),
},
'fast',
() => {
this.flashItem(this.$('.PostStream-item:last-child'));
}
);
}
/**
* Scroll down to a certain post by index.
*

View File

@@ -58,7 +58,7 @@ class PostStreamState {
// discussion and then scroll to the very bottom of the page.
if (number === 'reply') {
return this.goToLast().then(() => {
this.trigger('scrollToLast');
this.trigger('scrollToIndex', this.count());
});
}