mirror of
https://github.com/flarum/core.git
synced 2025-08-08 09:26:34 +02:00
Get rid of separate system for scrollToLast
This commit is contained in:
committed by
Franz Liedke
parent
c98c0b027f
commit
cc10eaadd2
@@ -102,7 +102,7 @@ export default class PostStream extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config(isInitialized, context) {
|
config(isInitialized, context) {
|
||||||
console.log('redrawing');
|
console.log('redrawing', this.state.visibleStart, this.state.visibleEnd);
|
||||||
if (this.state.needsScroll) {
|
if (this.state.needsScroll) {
|
||||||
this.state.needsScroll = false;
|
this.state.needsScroll = false;
|
||||||
const locationType = this.state.locationType;
|
const locationType = this.state.locationType;
|
||||||
@@ -279,20 +279,6 @@ export default class PostStream extends Component {
|
|||||||
return this.$() && $('#header').outerHeight() + parseInt(this.$().css('margin-top'), 10);
|
return this.$() && $('#header').outerHeight() + parseInt(this.$().css('margin-top'), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollToLast() {
|
|
||||||
return $('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 number and 'flash' it.
|
* Scroll down to a certain post by number and 'flash' it.
|
||||||
*
|
*
|
||||||
@@ -322,7 +308,7 @@ export default class PostStream extends Component {
|
|||||||
|
|
||||||
return this.scrollToItem($item, noAnimation, true, bottom).done(() => {
|
return this.scrollToItem($item, noAnimation, true, bottom).done(() => {
|
||||||
if (index == this.state.count() - 1) {
|
if (index == this.state.count() - 1) {
|
||||||
return this.scrollToLast();
|
this.flashItem(this.$('.PostStream-item:last-child'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user