I have a Lightbox where the user will select a location from a series of buttons. Depending on their answer, different content (strips) will show on a different page.
The code below isn’t working as it should. I’ve trawled through the API reference and other threads and can’t work out why it isn’t working. On the other page (below), it isn’t logging the “success”. What’s going on?!
Lightbox 1 (Button Selection)
import {session} from ‘wix-storage’ ;
import wixWindow from ‘wix-window’ ;
$w.onReady( function () {
});
export function Location1SelectionButton_click(event) {
session.setItem( “Location1Selection” );
wixWindow.lightbox.close( “#WelcomeLightbox” );
console.log( “Location1 Selected” )
}
export function Location2SelectionButton_click(event) {
session.setItem( “Location2Selection” );
wixWindow.lightbox.close( “#WelcomeLightbox” );
console.log( “Location2 Selected” )
}
On Other Page
import {session} from ‘wix-storage’ ;
import wixWindow from ‘wix-window’ ;
$w.onReady( function () {
//Location1
if (session.getItem( “Location1Selection” )){
$w( ‘#Location1Strip’ ).expand()
$w( ‘#Location2Strip’ ).collapse()
console.log( “Location1 Success” )
}
//Location2
if (session.getItem( “Location2Selection” )){
$w( ‘#Location1Strip’ ).collapse()
$w( ‘#Location2Strip’ ).expand();
console.log( “Location2 Success” )
}
});
I also have a button in the header (on all pages), where the user can change their location, which clears the session data. This isn’t working either.
export function CompanyLogoMaster_click(event) {
//Remove session storage of
session.clear();
console.log( “Session Data Cleared” )
//Open Lightbox
wixWindow.openLightbox( “WelcomeLightbox” );
session.setItem( “LightboxShown” , “yes” );
console.log( “Lightbox Opened by Logo” )
}
Thanks for your help in advance!