commit deb6682db704f87f8db1042f3a73d9577745efe5
parent 79afe73d21a3c67c78f9b46a75673f9db02e3e0f
Author: Damien Arrachequesne <damien.arrachequesne@gmail.com>
Date: Wed, 8 Mar 2017 06:56:54 +0100
feat(*): auto scroll to the bottom of the page
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/index.html b/index.html
@@ -11,6 +11,7 @@
#messages { list-style-type: none; margin: 0; padding: 0; }
#messages li { padding: 5px 10px; }
#messages li:nth-child(odd) { background: #eee; }
+ #messages { margin-bottom: 40px }
</style>
</head>
<body>
@@ -30,6 +31,7 @@
});
socket.on('chat message', function(msg){
$('#messages').append($('<li>').text(msg));
+ window.scrollTo(0, document.body.scrollHeight);
});
});
</script>