From 8a471e590a38c0b453d00ae474e729b72cb2b7c1 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Wed, 11 Jul 2012 22:30:03 +0200 Subject: [PATCH] Fix #581 Don't scroll chat automatically if user is not at the bottom --- src/static/js/chat.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/static/js/chat.js b/src/static/js/chat.js index b2a7d2737..28ceda975 100644 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -62,9 +62,10 @@ var chat = (function() }, scrollDown: function() { - if($('#options-scrollchat').is(':checked')){ - if($('#chatbox').css("display") != "none"){ + if($('#chatbox').css("display") != "none"){ + if(!self.lastMessage || self.lastMessage.position().top < $('#chattext').height()) { $('#chattext').animate({scrollTop: $('#chattext')[0].scrollHeight}, "slow"); + self.lastMessage = $('#chattext > p').eq(-1); } } },