Action on page from a Lightbox

Dear All,

I hope you are all well.

I have a page with a button (buttonOpenLightbox) to open a Lightbox.

Code on page
$w(“#buttonOpenLightbox”).onClick((event) => {
wixWindowFrontend.openLightbox(“Lightbox”);
});

When I close the Lightbox, I would like to hide the button (buttonOpenLightbox), that is on the page

Code on Lightbox
$w(“#CloseLightbox”).onClick((event) => {
wixWindowFrontend.lightbox.close();

////
WHAT IS THE CODE HERE?
///

});

Can someone help me?

Thank you.

Best regards,
Domivax

Inside the open and close functions of a lightbox you can add data-objects of your choice, to send data to, or from the lightbox to, from your wix-page.

Sending data to LIGHTBOX:

const myData = {
firstName: dima
lastName: russian
}

import wixWindowFrontend from "wix-window-frontend";

const lightboxID = 'RK5SLeeFTwhatever';

const myData = {
    firstName: dima
    lastName: russian
}

wixWindowFrontend.openLightbox(lightboxID, myData):

Receiving data back from Lightbox…

import wixWindowFrontend from "wix-window-frontend";

wixWindowFrontend.lightbox.close(lightboxData);