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

php - How to display all orders for a single product showing the most recent first? Woocommerce -

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

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -