files/en-us/web/api/element/scrollby/index.md
{{APIRef("CSSOM view API")}}
The scrollBy() method of the {{domxref("Element")}}
interface scrolls an element by the given amount.
scrollBy(xCoord, yCoord)
scrollBy(options)
xCoord
yCoord
options
top
left
behavior
smooth), happen instantly in a single jump (instant), or let the browser choose (auto, default).None ({{jsxref("undefined")}}).
// scroll an element
element.scrollBy(300, 300);
Using options:
element.scrollBy({
top: 100,
left: 100,
behavior: "smooth",
});
{{Specifications}}
{{Compat}}