Question:
Does anyone know why, and how to avoid, the empty space a container or its parent occupies doesn’t really match the actual space its items occupies? This is specifically when using media, but only for some items, in repeaters from what I’ve noticed.
Detailed explanation:
Had some strange issues when trying to create an FAQ control, that is fed from a Collection/DB. If I only stick to text it works perfectly, but as soon as I want to be able to dynamically add an image and/or video link (using custom elements since repeaters don’t allow iframe embeds and because the videos are hosted externally) I get alignment issues (shown in red):
In the example above I tried to just use a “button” to open the player in a modal window instead of a custom element inside the answerbox, but it still didn’t work.
The main reason seems to be that the element takes up (some) space (or ruins the padding settings) despite being hidden and/or deleted (“.delete()”) in the “answerbox”. I’ve tried different experiments using multistate boxes (image above) inside the answer box, to have a dedicated view for answers containing the standard text plus no image/video, both image and video, only image as well as only video. I’ve also tried using .hide() and .delete() and then collapsing and expanding the views to try to refresh the DOM, but to no avail.
This is the layer setup in the editor for the “multistate” attempt:
I’m well aware that Wix has its quirks and I bet there are workarounds that I just don’t know about. Would be very grateful for any hints or clues that might result in a solution to this problem.
Product:
Wix Studio Editor
What are you trying to achieve:
A dynamic and “fancy” FAQ where each item only takes up the space it needs for its content.
Something like these below.
Example for an answer that has no video nor image:
Example for an answer that has an embedded video for that specific answer:
What have you already tried:
A mixture of containers, multistate boxes, hiding/deleting items that shouldn’t show for a certain answer etc.