html - Display in Chat -


to display chat window, ended code :

function baja_el_chat() {   var height = 0;   $('div#my-conversation .message').each(function(i, value){       height += parseint($(this).height());   });    height += '';    $('div#my-conversation').animate({scrolltop: height}); } 

i did chat window scratch few weeks ago. way browser builds stack of divs make recent messages hidden below window's limits expected. same happened me built javascript/jquery function:

function baja_el_chat() {   var height = 0;   $('div#my-conversation .message').each(function(i, value){       height += parseint($(this).height());   });    height += '';    $('div#my-conversation').animate({scrolltop: height}); } 

basically measure height of content based on sum of chat bubbles , scroll amount. call function every time user hits enter or receives new message.


Comments

Popular posts from this blog

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -