Permalink
Browse files

Scroll down to the bottom of the page whenever a new message has been…

… added.
  • Loading branch information...
1 parent faa9341 commit f4944ba216f578fe95c493f162704a0133fe23dd @neojp neojp committed Feb 6, 2011
Showing with 4 additions and 0 deletions.
  1. +4 −0 public/index.html
View
@@ -61,6 +61,7 @@
+ '<th class="author">' + from + '</th>'
+ '<td class="msg">' + message + '</td>';
chatBody.appendChild(row);
+ scrollBody();
}
var handleMessage = function (data) {
var obj = JSON.parse(data);
@@ -101,6 +102,9 @@
sendMessage();
}
}
+ var scrollBody = function() {
+ document.body.scrollTop = document.body.clientHeight;
+ }
</script>
</div>
</body>

0 comments on commit f4944ba

Please sign in to comment.