getCurrentViewport( )


Gets the viewport currently selected in the Editor.

The getCurrentViewport() function returns a Promise that resolves to an object containing details about the currently selected viewport. To use this function on an inner (nested) widget, use getScopedWixEditor().

Method Declaration
Copy
function getCurrentViewport(): Promise<Viewport>;
Request
This method does not take any parameters
Returns
Return Type:Promise<Viewport>
Get the current viewport
JavaScript
import wixEditor from "wix-editor"; // ... wixEditor.getCurrentViewport().then((viewport) => { // Your code that uses the 'viewport' value goes here }); /* For example, `viewport` can be: { type: "DESKTOP", range: { minWidth: 1001, maxWidth: undefined } } */
Errors

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

Did this help?