getBoundingRect( )


Returns information about the window.

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.

Method Declaration
Copy
function getBoundingRect(): Promise<WindowSizeInfo>;
Request
This method does not take any parameters
Returns
Return Type:Promise<WindowSizeInfo>
Get information about the window
JavaScript
import { createClient } from "@wix/sdk"; import { site } from "@wix/site"; import { window as wixWindow } from "@wix/site-window"; const wixClient = createClient({ host: site.host(), modules: { wixWindow }, }); // ... (async () => { const windowSizeInfo = await wixClient.wixWindow.getBoundingRect(); let windowHeight = windowSizeInfo.window.height; // 565 let windowWidth = windowSizeInfo.window.width; // 1269 let documentHeight = windowSizeInfo.document.height; // 780 let documentWidth = windowSizeInfo.document.width; // 1269 let scrollX = windowSizeInfo.scroll.x; // 0 let scrollY = windowSizeInfo.scroll.y; // 120 })();
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?