mirror of
https://github.com/flarum/core.git
synced 2025-08-11 02:44:04 +02:00
Use scrollToIndex to contain scrollToLast
This commit is contained in:
committed by
Franz Liedke
parent
9a357f5d19
commit
51008bc65d
@@ -23,9 +23,6 @@ export default class PostStream extends Component {
|
|||||||
this.loadPageTimeouts = {};
|
this.loadPageTimeouts = {};
|
||||||
this.pagesLoading = 0;
|
this.pagesLoading = 0;
|
||||||
|
|
||||||
this.state.on('scrollToLast', () => {
|
|
||||||
this.scrollToLast();
|
|
||||||
});
|
|
||||||
this.state.on('scrollToNumber', (number, noAnimation) => {
|
this.state.on('scrollToNumber', (number, noAnimation) => {
|
||||||
this.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));
|
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.
|
* Scroll down to a certain post by index.
|
||||||
*
|
*
|
||||||
|
@@ -58,7 +58,7 @@ class PostStreamState {
|
|||||||
// discussion and then scroll to the very bottom of the page.
|
// discussion and then scroll to the very bottom of the page.
|
||||||
if (number === 'reply') {
|
if (number === 'reply') {
|
||||||
return this.goToLast().then(() => {
|
return this.goToLast().then(() => {
|
||||||
this.trigger('scrollToLast');
|
this.trigger('scrollToIndex', this.count());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user