Hi all,
I am having trouble with the collapse/expand code explained here: https://www.wix.com/code/home/example/Collapse-Elements
I have used the exact code and have gone through all my boxes and elements to check if they are labeled right. And yet when I publish the site the boxes are all collapsed and when i hold the curser over the arrow it recognizes that the item is “Clickable” but the boxes will not expand.
It is a dynamic page (no idea if that is an issue) and there is other code written on the page…
Anybody got an answer? The code im using is:
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() {
toggleFold(1);
}
export function headerBox2_onClick() {
toggleFold(2);
}
export function headerBox3_onClick() {
toggleFold(3);
}
export function headerBox4_onClick() {
toggleFold(4);
}
export function headerText1_onClick() {
toggleFold(1);
}
export function headerText2_onClick() {
toggleFold(2);
}
export function headerText3_onClick() {
toggleFold(3);
}
export function headerText4_onClick() {
toggleFold(4);
}