How to make vertical scroll to follow bottom until user will use it?

patriarca

New Member
E.g. as in every chat system scoll is following last added message but only if user don't use it. And it's becoming following the new messages each time when user put scroll to the bottom of the chat window.I've got basic chat window:\[code\]#messagewindow { overflow: auto; margin: 30px; top: 170px; width: 95%; height: 450px; bottom: 3em; }\[/code\]and populating \[code\]ul\[/code\] list inside it:\[code\]<div id="messagewindow"> <ul id="messages"> </ul></div>\[/code\]But scroll's cursor doesn't follow the new messages when window overflows. So how to make scrollbar's cursor to follow new messages when it's already on bottom? E.g. cursor must not follow new messages when user is trying to read something on top but only if user put cursor to bottom. I hope that it's regular need and there is must be something semi-default for my issue.
 
Top