i was wondering why the code is not working ? can you please have a look? did exactly as the example
https://y76353.wixsite.com/rotoniv/copy-of-1
this is my code:
function toggleFold(index) {
let $fold = $w('#fold' + index);
let $arrowDown = $w('#arrowDown' + index);
let $arrowRight = $w('#arrowRight' + index);
// toggle the fold at the index
if ($fold.collapsed) {
$fold.expand();
$arrowDown.show();
$arrowRight.hide();
}
else {
$fold.collapse();
$arrowDown.hide();
$arrowRight.show();
}
// collapse the other folds
[1,2,3,4]
.filter(idx => idx !== index)
.forEach(idx => {
$w('#fold' + idx).collapse();
$w('#arrowDown' + idx).hide();
$w('#arrowRight' + idx).show();
})
}
export function headerBox1_onClick(event) {
toggleFold(1);
}
export function headerBox2_onClick(event) {
toggleFold(2);
}
export function headerBox3_onClick(event) {
toggleFold(3);
}
export function headerBox4_onClick(event) {
toggleFold(4);
}
export function headerText1_onClick(event) {
toggleFold(1);
}
export function headerText2_onClick(event) {
toggleFold(2);
}
export function headerText3_onClick(event) {
toggleFold(3);
}
export function headerText4_onClick(event) {
toggleFold(4);
}
Best ,
Yael
Hi Tal, no worries i have resolved it.
Reason is because we cannot fully copy the example in Wix Code example.
The autogenerated onclick event has different naming in our current editor page. See image below. And we cannot edit that naming. So I need to change the "_onClick" in the code to "_click". Then everything works just fine. Probably Wix needs to update this change.
Hi,
This is an old thread. Please post a new thread and share with us the code you've written so that we can have a look.
Thanks,
Tal.
nope, Tomer, I had the same problem and redoing the event handler doesn't work for me.
Hi Yael,
I suspect there's a bug with the events.
Please try to create the event handlers again. Just click on the trash can next to the event handler in the properties panel (for example, next to headerBox1_onClick) and re-add it.
Let me know if it worked.