Community X.

Connect with other creators, share ideas, give feedback and get the latest product updates.

Feb 12
Edited: Feb 12

Creating Content Collections With Empty Fields

I am trying to create a dynamic page and I would like to be able to hide some elements if there is no data in the Content Collection.

I am able to almost completely hide anything using min-max on the grid and setting it to min-content and max-content, but if I have an image field then the image shows a broken link logo and textboxes still occupy some space even if they are empty.

Anyone has a solution for this?

2 answers2 replies
2
Best Answer
Feb 12

I think this might help you:

https://www.editorxcommunity.com/forum/main/comment/602331d245219500174dc6b4

Thanks! one more question if you can help me, im trying to access and change an elements margins from code. not sure how to do that.

Feb 18Edited: Feb 18

@Jonathan Elhalal I do not think it is possible.

But you can do something else.

You can use animation to move the element as much as you want.

You can do this with wixAnimation.

For example:



import wixAnimations from 'wix-animations';

$w('#button').onClick(() => {
    wixAnimation.timeline()
        .add($w('#your-element-id'), { x: -50, duration: 300 })
        .play();
});

API:

https://www.wix.com/velo/reference/wix-animations/timeline

1
Feb 13

You can put some lines of code in to check if data element in collection is empty and hide or collapse element.

Editor X

Design your boldest creations.