Search...
getCurrentViewport( )
Gets the viewport currently selected in the Editor.
Description
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()
.
Authorization
Request
This endpoint does not take any parameters
Response Object
Fulfilled - Object with the current Editor viewport.
NAME
TYPE
DESCRIPTION
type
string
Type of viewport (DESKTOP
, MOBILE
, or TABLET
)
An
viewportRange
object representing the current viewport's range.
Status/Error Codes
Was this helpful?
Get the current viewport
Copy Code
1import wixEditor from 'wix-editor';23// ...45wixEditor.getCurrentViewport()6 .then(viewport => {7 // Your code that uses the 'viewport' value goes here8 });910/* For example, `viewport` can be:11 {12 type: "DESKTOP",13 range: {14 minWidth: 1001,15 maxWidth: undefined16 }17 }18*/