Skip to content
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

Masonry-like layout #41

Closed
SqueezedLight opened this issue Apr 1, 2015 · 2 comments
Closed

Masonry-like layout #41

SqueezedLight opened this issue Apr 1, 2015 · 2 comments

Comments

@SqueezedLight
Copy link

Hi guys, can someone provide me with an example of a masonry-like layout? I'm having a hard time getting things to work. In my case every item has a different height. So i don't get how to set the layout accordingly, because the examples provided only use multiples of a specific height...
At the moment i use:
<ResponsiveReactGridLayout className="layout" breakpoints={{lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0}} cols={{lg: 12, md: 10, sm: 6, xs: 4, xxs: 2}}>

This adjusts the width of my items perfectly. But as described above every container has the same height - i know how to set this height to another value, but i need a container the same height as my item.

Beside that all items are on the same position (stacked on each other).

An example or any help would be much appreciated,
thanks a lot!

@STRML
Copy link
Collaborator

STRML commented Apr 2, 2015

Hey @SqueezedLight ,

Unfortunately, you will need to know the height of your items ahead of time, as this library does not have the ability (or the desire) to read from the DOM and adjust. It is meant to be a pure implementation, like React, where the DOM is considered write-only.

If you know your element heights ahead of time, you can change the rowHeight to something small like 10, and define the height as closely as possible. You may be able to even get away with 1, although I haven't tried it myself.

Set isDraggable and isResizable props to {false} and you should be on the right track.

@SqueezedLight
Copy link
Author

Hi, thanks for the fast reply and the good explanation. Glad i didn't miss something important :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants