The goog.positioning.AnchoredViewportPosition Class

goog.positioning.AnchoredViewportPosition
> goog.positioning.AnchoredPosition
> goog.positioning.AbstractPosition

goog.positioning.AnchoredViewportPosition(anchorElement, corner, opt_adjust, opt_overflowConstraint)

Encapsulates a popup position where the popup is anchored at a corner of an element. The corners are swapped if dictated by the viewport. For instance if a popup is anchored with its top left corner to the bottom left corner of the anchor the popup is either displayed below the anchor (as specified) or above it if there's not enough room to display it below. When using this positioning object it's recommended that the movable element be absolutely positioned.

anchorElement {Element}
Element the movable element should be anchored against.
corner {goog.positioning.Corner}
Corner of anchored element the movable element should be positioned at.
opt_adjust {boolean=}
Whether the positioning should be adjusted until the element fits inside the viewport even if that means that the anchored corners are ignored.
opt_overflowConstraint {goog.math.Box=}
Box object describing the dimensions in which the movable element could be shown.

.getLastResortOverflow()

returns {number}
A bitmask for the "last resort" overflow.

.reposition(movableElement, movableCorner, opt_margin, opt_preferredSize)

Repositions the movable element.

movableElement {Element}
Element to position.
movableCorner {goog.positioning.Corner}
Corner of the movable element that should be positioned adjacent to the anchored element.
opt_margin {goog.math.Box=}
A margin specified in pixels.
opt_preferredSize {goog.math.Size=}
The preferred size of the movableElement.

.setLastResortOverflow(lastResortOverflow)

lastResortOverflow {number}
A bitmask for the "last resort" overflow, if we fail to fit the element on-screen.