Repeater problem

I’m having trouble with an image in a repeater.

I have a repeater with 3 text items and one image item (image18). I want to collapse the image item if the value of the data for that image is undefined. My code seems to get to the correct place, but the image doesn’y collapse. Here’s the code.

if (wixWindowFrontend.formFactor === “Mobile”) {

$w("#repeater1").onItemReady(($item, itemData, index) => {

if (itemData.image === undefined) {

console.log(“COLLAPSE”);

$w(“#image18”).collapse();

} else {

console.log(“EXPAND”);

$w(“#image18”).expand();

}

});

}

Working in
e.g. Wix Studio Editor, Wix Editor, Dev Mode, CMS, etc.

Site link
If this is happening on a site, include a live or test site link

What I’m trying to do
Describe the goal or outcome you’re hoping for

What I’ve tried so far
Let us know what you’ve already tested, changed, or searched

Extra context
Anything else that might help - edge cases, screenshots, etc.

Hi, @Ron_Carran !!

For now, please try it this way. :innocent:

    if (!itemData.image) {
      console.log("COLLAPSE");
      $item("#image18").collapse();
    } else {
      console.log("EXPAND");
      $item("#image18").expand();
    }
1 Like

Thanks so much, onemoretime! It worked perfectly.