I am returning data to a repeater, but the size of the repeater items are all different based on the data that is being passed to them. I tried to account for this by adding extra space to the repeater items, however it is still not perfect.
I know that the wix compiler does not include access to dom elements so I can not set the size of the elements with the querySelectorAll attribute and instead have to rely on the built in $w selector.
However nowhere in the documentation does it mention anything about setting the height of an element. I tried to just use $w(“#myElement”).style.height = “500px” but it threw an error saying " TypeError: Cannot set properties of undefined (setting ‘height’) "
Is there a way to set a fixed height for repeater elements?
Hello. You cannot set a fixed height for a repeater through the style api. You can modify the look of the repeater in the editor UI or other users have found workarounds for adjusting repeater heights in the code like in this post
You can also create a wishlist request to add this ability to the api if you would like.
Thank you I did see that post, however my repeater items are not crowded and I have accounted for extra space. You can see an example image linked below. I read that you can get access to the dom if you upgrade the site. I will probably just have to do this so I can select the element and add a static height. If that still does not work I will create a wishlist request.
The differences in height for each repeater is not large, however it adds up. When one repeater tile is even slightly off the rest of the symmetry for the other ones are off as well which leads to a unsorted UI.
@amotor Can you show me where you saw that information? There is no additional dom access to be able to adjust repeater heights based on your account type that I am aware of, but I would be happy to investigate if you can send me the source.
Edit - unless you mean to be able to create custom elements, which do require a premium account with a connected domain and ads removed
This issue has been resolved by adding the following code into the header of the page the repeater is rendered into with a custom code snippit. The code is as follows:
You can learn more about how to add custom code here. You will need to upgrade to a premium plan before you are able to access this setting. Embedding Custom Code to Your Site | Help Center | Wix.com
Hope this helps anybody who is struggling with something similar