changeset 47:42b8c0229cd0

Fixed a scrolling problem.
author Atul Varma <varmaa@toolness.com>
date Tue, 28 Apr 2009 17:41:34 +0000
parents 346573b610cd
children 9c66f1f840f7
files openwebchat.html openwebchat.js
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/openwebchat.html	Tue Apr 28 17:37:09 2009 +0000
+++ b/openwebchat.html	Tue Apr 28 17:41:34 2009 +0000
@@ -13,6 +13,7 @@
 <div id="incoming-messages"></div>
 <textarea id="outgoing-message"></textarea>
 <p>Your name is <input type="text" id="name"/>.</p>
+<div id="bottom"></div>
 </div>
 <div id="templates">
   <div class="error">
--- a/openwebchat.js	Tue Apr 28 17:37:09 2009 +0000
+++ b/openwebchat.js	Tue Apr 28 17:41:34 2009 +0000
@@ -84,9 +84,10 @@
 
          block.hide();
          $('#incoming-messages').append(block);
-         block.slideDown(function() {
-                           window.scrollTo(0, $(window).height());
-                         });
+         block.slideDown(
+           function() {
+             window.scrollTo(0, $('#bottom').position().top);
+           });
        },
        onError: function onError(exception) {
          if (window.console)