wix-window.lightbox

wix-window.lightbox

A lightbox pops up on your site to grab your visitor's attention.

To use the Lightbox API, import wixWindow from the wix-window module:

ICAgaW1wb3J0IHdpeFdpbmRvdyBmcm9tICd3aXgtd2luZG93Jzs=
   import wixWindow from 'wix-window';

The APIs in wix-window.lightbox can only be used in front-end code.

Contents

close( ) Closes the lightbox.
getContext( ) Returns the data object that was passed to a lightbox.
close( )

close( )

Closes the lightbox.

function close([data: Object]): void

Description

The close function closes the lightbox and returns the given data to the openLightbox() function that was used to open the lightbox.

Parameters

data (optional) Object The data to pass back to openLightbox() function.

Examples

Close the lightbox

aW1wb3J0IHdpeFdpbmRvdyBmcm9tICd3aXgtd2luZG93JzsKCi8vIC4uLgoKd2l4V2luZG93LmxpZ2h0Ym94LmNsb3NlKCk7Cg==
import wixWindow from 'wix-window';

// ...

wixWindow.lightbox.close();

Close the lightbox and pass back data to the opening function

aW1wb3J0IHdpeFdpbmRvdyBmcm9tICd3aXgtd2luZG93JzsKCi8vIC4uLgoKd2l4V2luZG93LmxpZ2h0Ym94LmNsb3NlKGRhdGFPYmopOwo=
import wixWindow from 'wix-window';

// ...

wixWindow.lightbox.close(dataObj);
getContext( )

getContext( )

Returns the data object that was passed to a lightbox.

function getContext(): Object

Description

The getContext() function returns the data object passed when the lightbox was opened using the openLightbox() function, if any data was passed. If the lightbox was opened another way, getContext() returns undefined.

Return Value

Object The data object that was passed to the lightbox.

Examples

Get the data that was passed to the lightbox

aW1wb3J0IHdpeFdpbmRvdyBmcm9tICd3aXgtd2luZG93JzsKCi8vIC4uLgoKbGV0IHJlY2VpdmVkRGF0YSA9IHdpeFdpbmRvdy5saWdodGJveC5nZXRDb250ZXh0KCk7Cg==
import wixWindow from 'wix-window';

// ...

let receivedData = wixWindow.lightbox.getContext();