Fix mistake in chat example

This commit is contained in:
invzhi 2017-12-27 16:13:44 +08:00
parent cdedf21e58
commit 218298a8e5
1 changed files with 1 additions and 2 deletions

View File

@ -9,9 +9,8 @@ window.onload = function () {
var log = document.getElementById("log");
function appendLog(item) {
var doScroll = log.scrollTop > log.scrollHeight - log.clientHeight - 1;
log.appendChild(item);
if (doScroll) {
if (log.scrollHeight > log.clientHeight) {
log.scrollTop = log.scrollHeight - log.clientHeight;
}
}