Content loaded in a DIV with automatic scrolling bar

Asked

Viewed 379 times

0

I need your help. I’m setting up a chat system, and since I’m a hardhead, I’m putting it all together so I can learn. The point is, I have an index.php page and a page called chat.php. I would like to know how to create a script so that I can load the content of the chat.php page into a DIV on the index.php page and have the scroll automatically scroll down. I’ve tried to do it this way:

<script>
var tempo = window.setInterval(carrega, 5000);
function carrega()
{
$('#chat').load("chat.php");
}
</script>

Naturally, the scroll bar will return to the top at the end of the interval stipulated by setInterval, even if it descends manually downwards. How should I proceed to keep her down?

1 answer

2


  • Excellent! It worked 100%. Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.