Need help showing a section when clicking a button (Wix – Beginner)

Hi everyone! :waving_hand:

I’m building a site with Wix Studio, and I’m a bit stuck…

:backhand_index_pointing_right: What I want is simple in theory:
:right_arrow: When someone clicks a button, I’d like a new section or content to appear below — kind of like it unfolds.

I have 4 programmes and i would like to open 4 differents sections. Every clicks must open the good section.
I heard that multi-state boxes could help with that, but honestly… I’m struggling :sweat_smile:
I’m a complete beginner, just starting out with Wix.

:envelope_with_arrow: Could someone guide me step by step through how to do this properly?
Even if it’s super basic — I’d really appreciate a clear walkthrough :folded_hands:

Thanks so much in advance to anyone who takes the time to help!


PS: If you know a tutorial or a video example, I’d love to check it out too!

Set up the section and trigger button however you want them to appear on screen. Then in DEV mode enter this code inside or outside the onReady function:

$w("#buttonName").onClick(() => {
   $w("#sectionName").expand();
});

Now click on each of the two elements to find their IDs in the side panel and replace the IDs in the sample code. In the same panel where the section’s ID appears, you’ll checkmark the section’s default value as “collapsed”.

Now the section will only appear when you click the button.

1 Like

Hi, @Fabrice_Catala !!

There are various possible approaches :thinking: , but if you’re trying to achieve something without using code, one idea might be to creatively use the built-in “Accordion Menu” element in Wix. By placing the accordion inside a section and expanding it to match the section’s full width, you might be able to mimic the effect of opening multiple sections with a button click. I haven’t personally tried this, so I can’t guarantee it’ll work perfectly, but if you’re curious, it might be worth experimenting with. :innocent:

1 Like