Scroll down chat when receiving new message PHP MYSQL AJAX JAVASCRIPT

0

I'm searching for about 4 days on how to scroll the scroll bar of my chat when you receive new messages and scroll up to see the previous messages.

I made a script using setInterval , but when I try to roll div up, it returns down, getting pretty much "stuck" in the footer.

What can it be? I await answers, thank you.

    
asked by anonymous 09.10.2016 / 01:27

1 answer

0

You create a variable as soon as the PAGE opens. type var count = 0; then you make a request just to count how many messages you have in the DB. if the quantity is greater than the variable count you request the messages and update the count, with: count = qtdMessage; So what's the benefit of this?

  • You can still make the sound of a new message (msn, whatsapp, fb, skype, etc.), have you ever wondered if the chat is beeping every second? rsss
  • 15.10.2016 / 02:17