Search.../

getBoundingRect( )

Returns information about the window.

Description

The getBoundingRect() function returns a Promise that resolves to an object containing information about the current window's size, the document's size, and the current scroll position.

Syntax

function getBoundingRect(): Promise<WindowSizeInfo>

getBoundingRect Parameters

This function does not take any parameters.

Returns

Fulfilled - An object containing information about the window's size, the document's size, and the current scroll position.

Return Type:

Promise<WindowSizeInfo>
NAME
TYPE
DESCRIPTION
window
WindowSize

An object containing the size of the viewable area of the current browser window.

document
DocumentSize

An object containing the size of the actual body of the page, which may be larger or smaller than the current window.

scroll
ScrollOffset

An object containing the scroll offset of the page within the window from the top-left corner.

Was this helpful?

Get information about the window

Copy Code
1import wixWindowFrontend from 'wix-window-frontend';
2
3// ...
4
5wixWindowFrontend.getBoundingRect()
6 .then( (windowSizeInfo) => {
7 let windowHeight = windowSizeInfo.window.height; // 565
8 let windowWidth = windowSizeInfo.window.width; // 1269
9 let documentHeight = windowSizeInfo.document.height; // 780
10 let documentWidth = windowSizeInfo.document.width; // 1269
11 let scrollX = windowSizeInfo.scroll.x; // 0
12 let scrollY = windowSizeInfo.scroll.y; // 120
13 } );