Multi-State Box Buttons Closing Lightbox

Hello!

New to coding, so I’m not sure if I’m doing something wrong, or what’s happening, but…

I’m trying to make an accordion menu in a lightbox, to function as a popup menu on the right side. Doing this by layering multi-state boxes inside a lightbox.

I’ve used this elsewhere in the site (like in an admin dashboard page for input, and also in the Plant Nursery shop page for selecting things like Sun Requirements, Flower Color, etc) , and it works fine, however in the lightbox, every time a button to open/close a multi-state box is clicked, the entire lightbox closes itself.

Upon bringing the lightbox up again, the multi-state box retains it’s changed state. But a menu that you have to click, reopen, click, reopen just…isn’t a menu.

I’ve toggled the triggers for the “X” button, the “Close” button, and the “Overlay”, and even when they’re all set to negative, the buttons for the multi-stare boxes trigger the whole lightbox to close. Maddening.

Why is this happening? Any help or insight would be appreciated.

Here’s a snippet of the code I’m using:

$w . onReady ( function () {
//Main Menu “The Shop” Main Menu Box 1/3
$w ( “#TheShopButtonClosed” ). onClick (() => {
$w ( ‘#TheShopStateBox’ ). changeState ( “OpenTSSB” );
} );
$w ( “#TheShopButtonOpen” ). onClick (() => {
$w ( ‘#TheShopStateBox’ ). changeState ( “ClosedTSSB” );
} );
//Main Menu “The Botanical Gardens” Main Menu Box 2/3
$w ( “#BGardensButtonClosed” ). onClick (() => {
$w ( ‘#BGardensStateBox’ ). changeState ( “OpenBGSB” );
} );
$w ( “#BGardensButtonOpen” ). onClick (() => {
$w ( ‘#BGardensStateBox’ ). changeState ( “ClosedBGSB” );
} );
//Main Menu “The Datablog” Main Menu Box 3/3
$w ( “#DatablogButtonClosed” ). onClick (() => {
$w ( ‘#DatablogStateBox’ ). changeState ( “OpenDBSB” );
} );
$w ( “#DatablogButtonOpen” ). onClick (() => {
$w ( ‘#DatablogStateBox’ ). changeState ( “ClosedDBSB” );
} );

});

Wa-hey, fixed it.

Turns out the Button I’d been duplicating had a link to “current window”. Is there a Darwin Award for coding?

Anyway…if any one wants to make an accordion menu, layering multi-state boxes works!

Here’s the code template to apply to each multi-state box that you want to open/close

// your open/close accordion menu
$w ( “#yourButtonClosed” ). onClick (() => {
$w ( ‘#yourStateBox’ ). changeState ( “Openyourstate” ); } );
$w ( “#yourButtonOpen” ). onClick (() => {
$w ( ‘#yourStateBox’ ). changeState ( “Closedyourstate” ); } );