public/js/main.js
function scrollToBottom(){


var it= jQuery('#testit');
var message= jQuery('#messages');

var newMessage= message.children('li:last-child')
var clientH= it.prop('clientHeight');
var scrollTop=it.prop('scrollTop');
var scrollH=it.prop('scrollHeight');
var newMessageH= newMessage.innerHeight();
var prevmessageH=newMessage.prev().innerHeight();
var t=clientH+scrollTop+newMessageH+prevmessageH;
if(clientH+scrollTop+newMessageH+prevmessageH>=scrollH){
it.scrollTop(scrollH);
}
}
function scrollToBottom(){


var it= jQuery('#testit');
var message= jQuery('#messages');

var newMessage= message.children('li:last-child')
var clientH= it.prop('clientHeight');
var scrollTop=it.prop('scrollTop');
var scrollH=it.prop('scrollHeight');
var newMessageH= newMessage.innerHeight();
var prevmessageH=newMessage.prev().innerHeight();
var t=clientH+scrollTop+newMessageH+prevmessageH;
if(clientH+scrollTop+newMessageH+prevmessageH>=scrollH){
it.scrollTop(scrollH);
}
}
function scrollToBottom ( ) { var it = jQuery ( '#testit' ) ; var message = jQuery ( '#messages' ) ; var newMessage = message . children ( 'li:last-child' ) var clientH = it . prop ( 'clientHeight' ) ; var scrollTop = it . prop ( 'scrollTop' ) ; var scrollH = it . prop ( 'scrollHeight' ) ; var newMessageH = newMessage . innerHeight ( ) ; var prevmessageH = newMessage . prev ( ) . innerHeight ( ) ; var t = clientH + scrollTop + newMessageH + prevmessageH ; if ( clientH + scrollTop + newMessageH + prevmessageH >= scrollH ) { it . scrollTop ( scrollH ) ; } }
scroll to bottom
scroll to bottom