Created
May 15, 2009 21:30
-
-
Save bdougherty/112448 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Figure out heights and things | |
var chat = document.getElementById('chat_space'); | |
var currentScrollPos = chat.scrollTop; | |
var maxScrollPos = chat.scrollHeight - chat.clientHeight; | |
var scrolled = (currentScrollPos == maxScrollPos) ? true : false | |
// Clear out the box and replace with data from ajax | |
// Should we scroll? | |
if (scrolled) chat.scrollTop = chat.scrollHeight; | |
else chat.scrollTop = currentScrollPos; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment