diff options
author | lassulus <lassulus@googlemail.com> | 2013-11-07 13:33:31 +0100 |
---|---|---|
committer | lassulus <lassulus@googlemail.com> | 2013-11-07 13:33:31 +0100 |
commit | 7d45af90928ef9b1b4f6f7e316eb73f9a5ae0094 (patch) | |
tree | 23a54c22207d98f90c4d94e99c1779ae5cb413a6 /webchat/public | |
parent | 2b8ec51abb846040efcbbb1d4c2b6d1e4b6bab01 (diff) |
webchat: autoscroll
Diffstat (limited to 'webchat/public')
-rw-r--r-- | webchat/public/client.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/webchat/public/client.js b/webchat/public/client.js index e7179449..ca71b537 100644 --- a/webchat/public/client.js +++ b/webchat/public/client.js @@ -52,8 +52,11 @@ $(function connect() { console.log(object.message); var safe_message = $('<div/>').text(object.message).html(); safe_message = replaceURLWithHTMLLinks(safe_message); - var safe_from = $('<div/>').text(object.from).html(); - $('<tr><td class="chat_date">'+getCurTime()+'</td><td class="chat_from">'+safe_from+'</td><td class="chat_msg">'+safe_message+'</td></tr>').insertBefore('#foot'); + var safe_from = $('<div/>').text(object.from).html(); + $('<tr><td class="chat_date">'+getCurTime()+'</td><td class="chat_from">'+safe_from+'</td><td class="chat_msg">'+safe_message+'</td></tr>').insertBefore('#foot'); + + var elem = document.getElementById('chatter'); + elem.scrollTop = elem.scrollHeight; } catch (error) { console.log(error); |