fix scroll issue where focus is not well managed
This commit is contained in:
parent
b9802616b6
commit
4c667ecef6
|
@ -29,9 +29,11 @@ var chat = (function()
|
||||||
var self = {
|
var self = {
|
||||||
show: function ()
|
show: function ()
|
||||||
{
|
{
|
||||||
|
console.log("here");
|
||||||
$("#chaticon").hide();
|
$("#chaticon").hide();
|
||||||
$("#chatbox").show();
|
$("#chatbox").show();
|
||||||
$("#gritter-notice-wrapper").hide();
|
$("#gritter-notice-wrapper").hide();
|
||||||
|
console.log("scroll down 1");
|
||||||
self.scrollDown();
|
self.scrollDown();
|
||||||
chatMentions = 0;
|
chatMentions = 0;
|
||||||
Tinycon.setBubble(0);
|
Tinycon.setBubble(0);
|
||||||
|
@ -91,7 +93,9 @@ var chat = (function()
|
||||||
{
|
{
|
||||||
if($('#chatbox').css("display") != "none"){
|
if($('#chatbox').css("display") != "none"){
|
||||||
if(!self.lastMessage || !self.lastMessage.position() || self.lastMessage.position().top < $('#chattext').height()) {
|
if(!self.lastMessage || !self.lastMessage.position() || self.lastMessage.position().top < $('#chattext').height()) {
|
||||||
$('#chattext').animate({scrollTop: $('#chattext')[0].scrollHeight}, "slow");
|
// if we use a slow animate here we can have a race condition when a users focus can not be moved away
|
||||||
|
// from the last message recieved.
|
||||||
|
$('#chattext').animate({scrollTop: $('#chattext')[0].scrollHeight}, "fast");
|
||||||
self.lastMessage = $('#chattext > p').eq(-1);
|
self.lastMessage = $('#chattext > p').eq(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,6 +199,7 @@ var chat = (function()
|
||||||
});
|
});
|
||||||
if(!isHistoryAdd)
|
if(!isHistoryAdd)
|
||||||
self.scrollDown();
|
self.scrollDown();
|
||||||
|
console.log("scroll down 2");
|
||||||
},
|
},
|
||||||
init: function(pad)
|
init: function(pad)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue