openLightbox( )


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:

  1. Call this method to open a lightbox programmatically. For example, add a button with an onClick event handler that calls openLightbox().
  2. Set Automatically display lightbox on pages to No in the lightbox's settings under Set Triggers.

If you pass data to a lightbox, call the getContext() method in the lightbox's code to access the received data.

Notes:

  • Use the name of the lightbox and not the lightbox's ID when calling openLightbox(). You can find the lightbox's name by selecting the lightbox and clicking the settings button.
  • Only call openLightBox() after the onReady() method, once all page elements have finished loading.
Method Declaration
Copy
Method Parameters
namestringRequired

The name of the lightbox to open.


dataData

The data to pass to the lightbox.

Returns
Return Type:Promise<object>
Did this help?