Hello
I have two pages and what I want is the following: On page 1 when the button is clicked a lightbox appears and when page 2 opens I want the lightbox to close. Can you help?
Page1:
import wixWindow from ‘wix-window’ ;
wixWindow . openLightbox (’ lightbox’ );
Page 2
import wixWindow from ‘wix-window’ ;
wixWindow . lightbox.close() ;
But close doesn’t work
J.D
September 21, 2022, 7:37pm
2
The question is not clear. How do you navigate from page1, page to page2?
Why do you you open the lightbox on page2 if you want it to be closed there?
The button has a link (http) to page 2. The problem is when I open page 2 the lightbox remains open and does not close.
LIGHTBOX-CODE:
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
$w.onReady(()=>{
$w('#myButtonIdHere').onClick(()=>{
wixLocation.to('https://................');
wixWindow.lightbox.close();
});
});
J.D
September 22, 2022, 6:25pm
5
I still don’t understand.
When you move to another page the lightbox gets closed automatically, unless you reopen it on the second page.
I have a button on page 1 that has a link that is in the database . When the button is clicked and it goes to page 2 the lightbox does not disappear. Page 2 does not call the lightbox.
Code Page 1
import wixWindow from ‘wix-window’ ;
$w . onReady ( function () {
$w ( “#button1 ” ). target = “_self” ;
});
export function button1_click ( event ) {
wixWindow . openLightbox ( “lightbox” );
}
Button 1
J.D
September 24, 2022, 10:48pm
7
Maybe you set the lightbox to automatically open on Page2.
Check the lightbox settings.