class method document.viewport.getScrollOffsets

View source on GitHub →

document.viewport.getScrollOffsets() → Array

Returns the viewport's horizontal and vertical scroll offsets.

Returns an array in the form of [leftValue, topValue]. Also accessible as properties: { left: leftValue, top: topValue }.

Examples
document.viewport.getScrollOffsets();
//-> { left: 0, top: 0 }
 window.scrollTo(0, 120);
document.viewport.getScrollOffsets();
//-> { left: 0, top: 120 }