@hinterswill
Have a look here about working with elements id names, properties panel and user events etc.
https://support.wix.com/en/article/corvid-working-with-the-properties-panel https://support.wix.com/en/article/how-to-change-the-text-label-of-a-button-with-events https://support.wix.com/en/article/corvid-reacting-to-user-actions-using-events
So if you have changed the button id on your first button from say button1 to firstButton, then when you add the onClick through the properties panel it will automatically put it in your code as
export function firstButton_onClick(event) {
Don’t worry if your code doesn’t show the onClick and just shows click instead, just a newer way of doing the event handler in the code on your page.
Then you can simply add your code straight underneath it for the expand and collapse codes.
export function firstButton_onClick(event) {
$w("#firststrip").expand();
$w("#secondstrip").collapse();
$w("#thirdstrip").collapse();
}
Obviously, you would setup each strip with all the elements for that strip attached to it, so that whatever you do to the strip happens to the whole elements.
Wix Editor: Attaching Elements to Strips and Columns | Help Center | Wix.com
Wix Editor: Attaching Elements to a Box | Help Center | Wix.com
Wix Editor: Adding and Setting Up a Box | Help Center | Wix.com
Plus, have all the three strips setup to be collapsed on load in the properties panel for each strip element, that way everything in those three strips are not taking up any room on your page when the webpage is first loaded.
If you use .show() and .hide() instead of .expand() and .collapse(), you are getting the same thing happening on your page, however the strips will still be taking up room on your page and will just be hidden from view instead.
You would need to do the same code for all three buttons and strips, so simply change the button name in the export function and the strips to expand and close below it too.
Just make sure that you leave a line space between each export code line and you have matching parenthesis and curly brackets in your code. So, make sure that you have matching pairs of open { and closed } and open ( and closed ) in the code.
You will get used to doing this if you look at the code and see the symbols in the code itself.
So your code should look something like this, although remember that you would need to have the onReady page function at the top too.
export function firstButton_onClick(event) {
$w("#firststrip").expand();
$w("#secondstrip").collapse();
$w("#thirdstrip").collapse();
}
export function secondButton_onClick(event) {
$w("#secondstrip").expand();
$w("#firststrip").collapse();
$w("#thirdstrip").collapse();
}
//and so on.....
Finally, have a read here of how using collapse affects your page.
Velo: How Page Layout Is Affected When Elements Change Size | Help Center | Wix.com