Error in collapse-elements example

Hi can anyone help me with this?

I am trying to use Wix’s example https://www.wix.com/corvid/example/collapse-elements
and i have succeeded to do it, however i keep getting an error TypeError: $w(…).collapse is not a function
and then it takes me to line 19 which is $w(’ #fold ’ + idx).collapse();
but I don’t know what to change there.
I am using the code as is but i guess i am doing something wrong.
If anyone has made a video of this example it will be great to learn from it.

Thank you!

Maybe you didn’t set the correct property id in the properties panel.

I checked that all is good there in the property panel and that’s what i am not able to follow what is wrong

Are you sure you named the folds:
“fold1”, “fold2” etc… ?
Because this type of error probably indicates it failed to find the fold element.

Oh I guess coz i haven’t yet completed the full four folds? i was testing with one fold only

That can be it. If you call toggleFold(3) for example, you’ll get an error if you don’t have a fold with id “fold3”.

I made It :slight_smile: thank you so so much for helping me on this

J D
Is there a way i can reduce the bottom part which is created due to the box used in this process, as i need to put content below it. as i have 8 folds and now i have a lot of black space if i visit the live website

If you put an element right below the box (be sure it’s close enough), then there’ll be no space left once the box got collapsed.