How do I scroll to the bottom of the page?
scroll(){
let container = this.$el.querySelector('#scrollingChat')
container.scrollTop = container.scrollHeight
}
I'm doing this, and always calling my api answers, but it does not go to the bottom of the page
window.scrollTo(0, document.body.scrollHeight || document.documentElement.scrollHeight);
This is will instantly scroll to the bottom of any page.
If you create an anchor in your page like so:
<div id="top"></div>
you can use:
let elmnt = document.getElementById('top');
elmnt.scrollIntoView(false);
This page explains what the different alignment parameters do for scrollIntoView:
true - scrolls to top of element
false - scrolls to bottom of element
default it true
https://www.w3schools.com/jsref/met_element_scrollintoview.asp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With