on-internet
← Community

scrollTo() function does nothing

Stack Overflow ·

I wanted to scroll to the bottom of the page using vanilla JS, but I encountered a problem. The code below is supposed to scroll to the bottom of the page: window.scrollTo(0,document.body.scrollHeight); Whereas all it does is logs "undefined" in the console. Inputting document.body.scrollHeight returns an integer 736. Other than that, it doesn't matter what I input into the function's parameters, nothing happens. What more, it only happens on one website. What may matter (not sure) is that the website hides its vertical scrolling bar, even thought it has a really long list of content.

Comments

Sign in or sign up to comment and upvote.

No comments yet.