JavaScript window.scroll vs. window.scrollTo?
There are no differences: https://developer.mozilla.org/en/DOM/window.scroll
As far as I know, all major browsers support both.
Window.scrollTo()
is effectively the same as the window.scroll(x,y)
method. For scrolling a particular distance, use Window.scrollBy()
.
Also see Window.scrollByLines()
, Window.scrollByPages()
and Element.scrollIntoView()
MDN - https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll