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 - Autoloader issue not returning Class -

C++ Program To Find Smallest and Largest Number In Array -

java - How to put two numbers separated by a space into two different arrays -