Scroll to bottom when adding a new message (#1450)
Added a comment to try to make this easier to understand as you read it. FREEBIE
This commit is contained in:
parent
1b444a5e23
commit
db869c6ce4
1 changed files with 6 additions and 1 deletions
|
@ -48,7 +48,12 @@
|
|||
this.$el.scrollTop(this.scrollPosition - this.$el.outerHeight());
|
||||
},
|
||||
scrollToBottomIfNeeded: function() {
|
||||
if (!this.atBottom()) {
|
||||
// This is counter-intuitive. Our current bottomOffset is reflective of what
|
||||
// we last measured, not necessarily the current state. And this is called
|
||||
// after we just made a change to the DOM: inserting a message, or an image
|
||||
// finished loading. So if we were near the bottom before, we _need_ to be
|
||||
// at the bottom again. So we scroll to the bottom.
|
||||
if (this.atBottom()) {
|
||||
this.scrollToBottom();
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue