fuxingloh / vue-masonry-wall

A pure vue responsive masonry layout without direct dom manipulation and ssr support.
https://nuxt-app.fuxing.dev/vue-masonry-wall
MIT License
211 stars 31 forks source link

Filling of shortest column first #48

Open davestewart opened 2 years ago

davestewart commented 2 years ago

HI there,

I have a page where I show various blog articles in sections.

Ideally these would fill left to right, top to bottom, but of course masonry will fill the shortest column first.

Whilst this may be acceptable in middle rows, in end rows, it can leave items aligned in strange ways – I've have had one left and right, and one on the right as below:

image

I suggest that this could be prevented by adding another property which would provide a threshold (px or item height %) to compare against the shortest column's gap. If the gap was under the given threshold it would tile left to right (which would normally be chronological order), over which, it would fill the gap.

I've not tested this, but suggest it would be a nice tweak for things like blogs, where users would expect to read left to right.