JS role para baixo
window.scrollTo(0,document.body.scrollHeight);
Shy Skunk
window.scrollTo(0,document.body.scrollHeight);
// To scroll to the bottom of a div
const theElement = document.getElementById('elementID');
const scrollToBottom = (node) => {
node.scrollTop = node.scrollHeight;
}
scrollToBottom(theElement); // The specified node scrolls to the bottom.
// without smooth-scroll
const scrollToBottom = () => {
divRef.current.scrollTop = divRef.current.scrollHeight;
};
//with smooth-scroll
const scrollToBottomWithSmoothScroll = () => {
divRef.current.scrollTo({
top: divRef.current.scrollHeight,
behavior: 'smooth',
})
}
scrollToBottom()
scrollToBottomWithSmoothScroll()
//scroll to the bottom of "#myDiv"
var myDiv = document.getElementById("myDiv");
myDiv.scrollTop = myDiv.scrollHeight;
document.getElementsByClassName('className')[0].scrollTop = document.getElementsByClassName('className')[0].scrollHeight;
const scrollToBottom = (element) =>
element.scrollIntoView({ behavior: "smooth", block: "end" });