Introduction

To learn more about lightboxes, see the Hello Lightboxes example page.

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

Copy

The APIs in wix-window-frontend.Lightbox can only be used in frontend code.

Did this help?

close( )


Closes a lightbox.

The close() method closes a lightbox and allows you to pass data from the lightbox to the page that opened the lightbox. If a lightbox is closed through the 'X' icon, close button, or lightbox overlay, data will not be returned to the original page.

To ensure data can be passed:

  1. Call this method to close a lightbox programmatically. For example, add a button with an onClick event handler that calls close().
  2. Disable these closing options in the lightbox's settings under Set Triggers.
Method Declaration
Copy
function close(data: object): void;
Method Parameters
dataData

The data to pass back to the openLightbox() method.

JavaScript
import wixWindowFrontend from "wix-window-frontend"; // ... wixWindowFrontend.lightbox.close();
Did this help?