scroll in javascript

0

I have the following code:

function scroll() {

  shouldScroll = chat.scrollTop + chat.clientHeight === chat.scrollHeight;
  if (!shouldScroll) {
    scrollToBottom();
  }
}
function scrollToBottom() {
  chat.scrollTop = chat.scrollHeight;
}
scrollToBottom();
setInterval(scroll, 100);

The problem is that when I want to upload to read the conversations, it is automatically downloaded. I understand that it is the setInterval but without teaching it does not automatically come down in my chat. How can i fix it?

Thanks

    
asked by Isaac Alejandro 10.12.2018 в 20:43
source

0 answers