namespace document.viewport

Description

The document.viewport namespace contains methods that return information about the viewport — the rectangle that represents the portion of a web page within view. In other words, it's the browser window minus all chrome.

Class methods

  • getDimensions #

    document.viewport.getDimensions() ⇒ Object

    Returns the size of the viewport.

    Returns an object of the form { width: Number, height: Number }.

  • getHeight #

    document.viewport.getHeight() ⇒ Number

    Returns the height of the viewport.

  • getScrollOffsets #

    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 }.

  • getWidth #

    document.viewport.getWidth() ⇒ Number

    Returns the width of the viewport.