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>

Was this helpful?

Get information about the window

Code Example

Copy Code
1import wixWindow from 'wix-window';
2
3// ...
4
5wixWindow.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 } );