forked from snxraven/LinkUp-P2P-Chat
Re add scroll to bottom
This commit is contained in:
parent
ef312ad068
commit
6463f2e526
7
app.js
7
app.js
@ -237,6 +237,12 @@ function sendMessage(e) {
|
||||
}
|
||||
}
|
||||
|
||||
function scrollToBottom() {
|
||||
var container = document.getElementById("messages-container");
|
||||
container.scrollTop = container.scrollHeight;
|
||||
}
|
||||
|
||||
|
||||
function onMessageAdded(from, message, avatar) {
|
||||
const $div = document.createElement('div');
|
||||
$div.classList.add('message');
|
||||
@ -265,6 +271,7 @@ function onMessageAdded(from, message, avatar) {
|
||||
$div.appendChild($content);
|
||||
|
||||
document.querySelector('#messages').appendChild($div);
|
||||
scrollToBottom();
|
||||
}
|
||||
|
||||
async function updateIcon(username, avatarBuffer) {
|
||||
|
Loading…
Reference in New Issue
Block a user