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;
setInterval(function(){
$('html, body').animate({ scrollTop: $(document).height() - $(window).height() }, 1500, function() {
$(this).animate({ scrollTop: 0 }, 1500);
});
}, 2000);//run this thang every 2 seconds
function gotoBottom(id){
var element = document.getElementById(id);
element.scrollTop = element.scrollHeight - element.clientHeight;
}