files/en-us/web/api/window/scroll/index.md
{{APIRef}}
The Window.scroll() method scrolls the window to a
particular place in the document.
scroll(xCoord, yCoord)
scroll(options)
xCoord
yCoord
options
top
left
behavior
smooth: scrolling should animate smoothlyinstant: scrolling should happen instantly in a single jumpauto: scroll behavior is determined by the computed value of {{cssxref("scroll-behavior")}}None ({{jsxref("undefined")}}).
// Put the 100th vertical pixel at the top of the window
window.scroll(0, 100);
Using options:
window.scroll({
top: 100,
left: 100,
behavior: "smooth",
});
{{domxref("Window.scrollTo()")}} is effectively the same as this method. For relative scrolling, see {{domxref("Window.scrollBy()")}}, {{domxref("Window.scrollByLines()")}}, and {{domxref("Window.scrollByPages()")}}.
For scrolling elements, see {{domxref("Element.scrollTop")}} and {{domxref("Element.scrollLeft")}}.
{{Specifications}}
{{Compat}}