Opens a lightbox and optionally passes it the given data.
The openLightbox()
method opens a lightbox and allows you to pass data to it.
Lightboxes that are opened automatically on page load, or via a link from a page element don't receive passed data.
To ensure data can be passed:
onClick
event handler that calls openLightbox()
.If you pass data to a lightbox, call the getContext()
method in the lightbox's code to access the received data.
Notes:
openLightbox()
. You can find the lightbox's name by selecting the lightbox and clicking the settings button.openLightBox()
after the onReady()
method, once all page elements have finished loading.function openLightbox(name: string, data: object): Promise<object>;
The name of the lightbox to open.
The data to pass to the lightbox.
import wixWindowFrontend from "wix-window-frontend";
// ...
wixWindowFrontend.openLightbox("LightboxName");
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.