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?
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.
@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
You can put some lines of code in to check if data element in collection is empty and hide or collapse element.