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