Having problems with collapse and expand elements

I’m having a problem with collapse and expand. It was working just fine and since 3 days ago is not working anymore. The box doesn’t open when requested. Please see the code below:


Please can somebody help me?

1 Like

Check the property panel and make sure the box170_click function is on.

Couple of similar fresh threads:

https://www.wix.com/corvid/forum/community-discussion/hide-show-function-not-working

https://www.wix.com/corvid/forum/community-discussion/expand-collapse-not-working-on-published-site

Thanks, the box 170 is on… still not working :frowning:

@opalatur so instead of export function box170_click try:

$w.onReady(() => [
$w("#box170").onClick(event => {
//put the consitional code here
})
})

Please post an example that we can check what is going wrong, or at least step to recreate the flow.

Thanks.

Here: opalatur. com. br /ironman-70-3-maceio

@jonatandor35 I’ve tried and still didn’t work, it stays collapsed and doesn’t expand when clicked.

I finally got it right, I did change to teh code below and it worked, use a comma between the different boxes (170, 171, 172…)

$w( "#box170" ).onClick(event => { 

let $fold1 = $w( ‘#group4’ );
let $imgdir = $w( ‘#vectorImage12’ );
let $imgdown = $w( ‘#vectorImage11’ );

// toggle the fold at the index
if ($fold1.collapsed) {
$fold1.expand();
$imgdown.show();
$imgdir.hide();
}
else {
$fold1.collapse();
$imgdown.hide();
$imgdir.show();
}
}),