Repeater: expand on click

Hi guys,
I have a repeater with:
1.arrow button
2. fold box (collapsed on load)

I’d like the fold element to expand when the arrow button is clicked.
Can please let me know why the following code doesn’t work and the fold doesn’t expand on click?

Thanks,
J.D.

$w.onReady( function () {
$w(“#repeater1”).onItemReady( ($item, itemData, index) => {
$item(“#arrow”).onClick( (event) => {
if ( $item(“#fold1”).collapsed) {
$item(“#fold1”).expand();
}
else {
$item(“#fold1”).collapse();
}
})
})
});

Never mind. It works now.

Hey J.D! I’m trying to do the same thing. I have the same set up, if not very similar.
Currently my code is as follows, but im trying to expand or collapse the fold on only one repeater item and right now it happens to all of them no matter which repeater item is clicked on. What am I missing?
Site URL: https://www.yogadarshanacenter.com/retreats

export function arrowOpen_click ( event ) {
$w ( “#fold1” ). expand ();
$w ( “#arrowClose” ). show ();
$w ( “#arrowOpen” ). hide ();
}

export function arrowClose_click ( event ) {
$w ( “#fold1” ). collapse ();
$w ( “#arrowOpen” ). show ();
$w ( “#arrowClose” ). hide ();
}

It happens, because you do not have the same code-setup like J.D.
Please take a careful look onto J.D.'s provided code-example and try to figure out the difference.

Perhaps you try this one…

$w.onReady(function () {
   $w("#repeater1").onItemReady(($item, itemData, index) => {
       $item("#arrow").onClick((event) => {
           if($item("#fold1").collapsed) {
              $item("#fold1").expand();
              $item("#arrowClose").show();
              $item("#arrowOpen").hide();
           }
           else {
              $item("#fold1").collapse(); 
              $item("#arrowOpen").show();
              $item("#arrowClose").hide();
          }
       })
   })
});

The other question is → do you need 2-buttons for openening and closing process? J.D.'s example uses just 1-button.

@jessrightdesign Just tried your website and it seems to be working just fine.

Cheers.

@bwprado Yes! Got it to work! Thanks for checking! :slight_smile: