Skip to content

Commit

Permalink
chat: scroll down on first rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
le-jeu committed Dec 24, 2020
1 parent 0391b99 commit 278923f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/code/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,14 @@ window.chat.renderData = function(data, element, likelyWereOldMsgs) {
prevTime = nextTime;
});

var firstRender = elm.is(':empty');
var scrollBefore = scrollBottom(elm);
elm.html('<table>' + msgs + '</table>');
chat.keepScrollPosition(elm, scrollBefore, likelyWereOldMsgs);

if (firstRender)
elm.data('needsScrollTop', 99999999);
else
chat.keepScrollPosition(elm, scrollBefore, likelyWereOldMsgs);
}


Expand Down

0 comments on commit 278923f

Please sign in to comment.