When adding new messages on the chat, chat content refreshes adding the new message and moving the scrollbar to the top. I am trying to make it stay bottom but can't figure it out alone.
This is in my html page:
<script type="text/javascript">
<!--
var iChat_cfg = ["300", "15"];
var iChat_lang = ["Edit messages", "Write a new message", "iChat error", "Write your message.", "Your message text is too long.", "Agree", "Save Settings", "Clear DB", "Check for updates"];
function reFreshiChat()
{
iChatRefresh('site');
return false;
};
setInterval(reFreshiChat , iChat_cfg[1]*1000);
//-->
</script>
<div id="iChat-style">
<div id="iChat-messages" align="left">
<div class="chat">Message 1</div>
<div class="chat">Message 2</div>
<div class="chat">Message 3</div>
<div class="chat">Message 4</div>
<div class="chat">Message 5</div>
</div>
</div>
This is in my js file:
function iChatRefresh(place)
{
$.post(dle_root + "engine/modules/iChat/ajax/refresh.php", { action: "refresh", place: place }, function(data){
if(data != 'no need refresh'){
$("#iChat-messages").html(data);
};
});
return false;
};
and css:
#iChat-style {
width:100%;
height:300px;
overflow:auto;
}