I'm trying to scroll a div
to their bottom when some button is clicked (chat context) but it's not working properly
In this chat i need to show the message at the top on start and when i get more content scroll automatically to the bottom showing the most recent messages, I already tried scrollIntoView
as in the following code:
const element = this.$el.querySelector(".chat-box");
element.scrollIntoView({behavior: "smooth", block: "end"})
}
I expect to scroll to end of the div
, but actually scrolling near to the bottom, missing some content.
Only scrollIntoView
actually move the scroll, i tried element.scrollTop = element.scrollHeigh
and nothing happens