-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to make height dynamic? #9
Comments
If you pass the image height and width (whether from the DOM or otherwise) into your grid item you can determine its ratio. Then you could set the height of each box to zero and set its I haven't tried it but it should work, including responsively without re-render. Edit: Scratch that, the parent container's height will always be 0 since it is an accumulative height of each item. You'd probably need to set an image's height by fetching its width from the DOM once it has loaded. |
I did it the following: Then, in your grid props heights use the images width, height and container width to measure the height of the element. Keep in mind to fracture it with the count of columns.
|
@eriksachse, the height can not calculate for some reason, still not work to me |
Hello, thank you for creating mauerwerk.
I am having some trouble making modifications as I am still kind of new to react.
What I am trying to do is fit image contents in the grid cells, and instead of specifying the height of each cells, I want to adapt the height to whatever contents is in the cell.
If you point out where should I be looking at, I would be very grateful.
The text was updated successfully, but these errors were encountered: