files/en-us/web/api/element/scroll/index.md
{{APIRef("CSSOM view API")}}
The scroll() method of the {{domxref("Element")}}
interface scrolls the element to a particular set of coordinates inside a given
element.
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 1000th vertical pixel at the top of the element
element.scroll(0, 1000);
Using options:
element.scroll({
top: 100,
left: 100,
behavior: "smooth",
});
{{Specifications}}
{{Compat}}