desandro / masonry

:love_hotel: Cascading grid layout plugin
https://masonry.desandro.com
16.38k stars 2.11k forks source link

Long image down side only works with specific measurements #1058

Closed tomob7 closed 6 years ago

tomob7 commented 6 years ago

Hi Guys,

Can anyone let me know why the below is not working, I require one long image down the right but it only seems to work with one set of specific measurements and anything else does not seem to give the desired layout.

The measurements that work and the desired layout

https://codepen.io/tomob7/pen/bjqKzJ

The measurements that do not work which as far as I can tell equal the same width

https://codepen.io/tomob7/pen/OwpENv

My stack overflow for additional reference.

https://stackoverflow.com/questions/51269700/masonry-only-working-with-one-size-setting-48-23

Is this a bug or am I missing something?

desandro commented 6 years ago

Thanks for reporting this issue. The value of columnWidth should be set a highest common divider of the widths of the items. So if your items have widths of 30% and 40%, columnWidth should be 10%. See demo https://codepen.io/desandro/pen/879ab4752028889e8e7967875553496a/

tomob7 commented 6 years ago

Thanks for this, life saver! Great piece of software by the way :D