mirror of https://github.com/gorilla/websocket.git
Fix mistake in chat example
This commit is contained in:
parent
cdedf21e58
commit
218298a8e5
|
@ -9,9 +9,8 @@ window.onload = function () {
|
||||||
var log = document.getElementById("log");
|
var log = document.getElementById("log");
|
||||||
|
|
||||||
function appendLog(item) {
|
function appendLog(item) {
|
||||||
var doScroll = log.scrollTop > log.scrollHeight - log.clientHeight - 1;
|
|
||||||
log.appendChild(item);
|
log.appendChild(item);
|
||||||
if (doScroll) {
|
if (log.scrollHeight > log.clientHeight) {
|
||||||
log.scrollTop = log.scrollHeight - log.clientHeight;
|
log.scrollTop = log.scrollHeight - log.clientHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue