masonry icon indicating copy to clipboard operation
masonry copied to clipboard

Wrong gutter of the grid item if its width is different

Open codyng opened this issue 4 years ago • 1 comments

Hi there,

I've just first tested this amazing library and tried a simple usage. Let's say the default (and first item) item is 200px in width. The gutter is 10px. Everything is fine.

However, I've tried to make one of the grid item to be > 200px width, or < 200px width and it did not show the correct gutter.

I don't understand why it has the wrong gutter like the screenshots (in both cases).

Thanks.

When the width of the 3rd item is 300px:

Screenshot 2021-01-20 at 19 39 26

When the width of the 3rd item is 100px:

Screenshot 2021-01-20 at 19 39 48

options is at below:

{
    columnWidth: 200,
    itemSelector: '.grid-item',
    gutter: 10
}

CSS with the wider (or shorter) item for test:

.grid-item--width2 {
    width: 100px;
    background: #EFEFEF;
}

Expected result: all gutters are in 10px width. (Using "masonry-layout": "4.2.2")

codyng avatar Jan 20 '21 11:01 codyng

What about: { columnWidth: 100, itemSelector: '.grid-item', gutter: 10 } And: .grid-item--width2 { width: 210px; /* 2 columns+1 gutter / background: #EFEFEF; } .grid-item--width3 { width: 320px; / 3 columns+2 gutters */ background: #AFAFAF; }

robfaas avatar Mar 23 '21 21:03 robfaas