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 wixWindow from 'wix-window';23// ...45wixWindow.getBoundingRect()6 .then( (windowSizeInfo) => {7 let windowHeight = windowSizeInfo.window.height; // 5658 let windowWidth = windowSizeInfo.window.width; // 12699 let documentHeight = windowSizeInfo.document.height; // 78010 let documentWidth = windowSizeInfo.document.width; // 126911 let scrollX = windowSizeInfo.scroll.x; // 012 let scrollY = windowSizeInfo.scroll.y; // 12013 } );