Maintain bottom-most scroll position when resizing conversation area.

Closes #278
pull/749/head
adambar 10 years ago committed by lilia
parent 1a82a12a30
commit 476eb54db1

@ -217,12 +217,21 @@
} }
var $discussionContainer = this.$('.discussion-container'), var $discussionContainer = this.$('.discussion-container'),
$bottomBar = this.$('.bottom-bar'); $bottomBar = this.$('.bottom-bar'),
$messageList = this.$('.message-list');
var scrollPosition = $messageList.scrollTop() + $messageList.outerHeight(),
scrollHeight = $messageList[0].scrollHeight,
shouldStickToBottom = scrollPosition === scrollHeight;
window.autosize(this.$messageField); window.autosize(this.$messageField);
$bottomBar.outerHeight(this.$messageField.outerHeight() + 1); $bottomBar.outerHeight(this.$messageField.outerHeight() + 1);
var $bottomBarNewHeight = $bottomBar.outerHeight(); var $bottomBarNewHeight = $bottomBar.outerHeight();
$discussionContainer.outerHeight(this.$el.outerHeight() - $bottomBarNewHeight - this.$('#header').outerHeight()); $discussionContainer.outerHeight(this.$el.outerHeight() - $bottomBarNewHeight - this.$('#header').outerHeight());
if (shouldStickToBottom) {
$messageList.scrollTop(scrollHeight);
}
}, },
forceUpdateMessageFieldSize: function (event) { forceUpdateMessageFieldSize: function (event) {

Loading…
Cancel
Save