Scroll down when you receive new PHP MYSQL AJAX JAVASCRIPT message

Asked

Viewed 209 times

0

I’ve been searching for about 4 days on how to scroll my chat scroll when I receive new messages and scroll up to see previous messages.

I made a script using setInterval, but when I try to roll the div up, the same returns down, getting practically "glued" in the footer.

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

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 there are in DB. if the amount is greater than the count variable vc requests the messages and updates the count, with: count = qtdMensage; hence the advantage of this ?

  1. since there is a request being made every second, it avoids that the application(whatever) is printing all the time, what ends up upsetting the user that n can upload the scroll p read old messages.
  2. vc still gives p to make the new message sound (type msn, Whatsapp, fb, skype, etc), ever wondered if the chat beeps non-stop every second ? rsss

Browser other questions tagged

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