Commit fc21859f authored by Markus Bergt's avatar Markus Bergt

added initial scroll

parent 511393ac
...@@ -6,6 +6,8 @@ $(document).ready(function() { ...@@ -6,6 +6,8 @@ $(document).ready(function() {
}); });
}, 1000); }, 1000);
scrollToEnd();
function UseData(data){ function UseData(data){
var obj = jQuery.parseJSON(data); var obj = jQuery.parseJSON(data);
if(!!obj.UsersTable) if(!!obj.UsersTable)
...@@ -15,13 +17,18 @@ $(document).ready(function() { ...@@ -15,13 +17,18 @@ $(document).ready(function() {
if(!!obj.newMessages) if(!!obj.newMessages)
{ {
$('#chatbody').append(obj.newMessages); $('#chatbody').append(obj.newMessages);
scrollToEnd();
}
}
function scrollToEnd()
{
$('html, body').animate({ $('html, body').animate({
scrollTop: $(document).height()-$(window).height()}, scrollTop: $(document).height()-$(window).height()},
500, 500,
"swing" "swing"
); );
} }
}
$('#showRegBtn').click(function(){ $('#showRegBtn').click(function(){
$('#loginCol').hide(); $('#loginCol').hide();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment