The VisualViewport interface of the the Visual Viewport API represents the visual viewport for a given window. For a page containing iframes, each iframe, as well as the containing page, will have a unique window object. Each window on a page will have a unique VisualViewport representing the properties associated with that window.

Documentation VisualViewport by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Variables

read onlyheight:Float

Returns the height of the visual viewport in CSS pixels.

read onlyoffsetLeft:Float

Returns the offset of the left edge of the visual viewport from the left edge of the layout viewport in CSS pixels.

read onlyoffsetTop:Float

Returns the offset of the top edge of the visual viewport from the top edge of the layout viewport in CSS pixels.

read onlypageLeft:Float

Returns the x coordinate relative to the initial containing block origin of the top edge of the visual viewport in CSS pixels.

read onlypageTop:Float

Returns the y coordinate relative to the initial containing block origin of the top edge of the visual viewport in CSS pixels.

read onlyscale:Float

Returns the pinch-zoom scaling factor applied to the visual viewport.

read onlywidth:Float

Returns the width of the visual viewport in CSS pixels.

Inherited Variables

Inherited Methods

Defined by EventTarget

addEventListener(type:String, listener:Function, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

addEventListener(type:String, listener:EventListener, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

Register an event handler of a specific event type on the EventTarget.

Throws:

null

DOMError

dispatchEvent(event:Event):Bool

Dispatch an event to this EventTarget.

Throws:

null

DOMError

removeEventListener(type:String, listener:Function, ?options:EitherType<EventListenerOptions, Bool>):Void

removeEventListener(type:String, listener:EventListener, ?options:EitherType<EventListenerOptions, Bool>):Void

Removes an event listener from the EventTarget.

Throws:

null

DOMError