Using switch element within repeater

I have repeater2 on my page and 2 containers the switch element resides inside a sub container ‘headerBox1’ and displays a 2nd container fold1 when the switch changes. (modified an example from the wix site)
this code works, except because it is inside the repeater when I click on the switch it shows the fold container on all records in the dataset but doesn’t update the switch on records.
I’d prefer the switch change only shows/hides the current record’s container - fold1.
How do I modify my code to achieve this? - thanks

export function switch1_change(event) {
//Add your code for this event here:
toggleFold(1);
}

function toggleFold(index) {
let $fold = $w(‘#fold’ + index);
// toggle the fold at the index
if ($fold.collapsed) {
$fold.expand();
}
else {
$fold.collapse();
}
}

You need to access the item on scope, here’s how