I have multiple items organized in multiple columns and rows
<div class="items">
<div class="item-1">
<div class="item-2">
<div class="item-3">
<div class="item-4">
<div class="item-5">
...
</div>
I'm using jQuery slidedown to show hide content of each item when clicks. I want to push the bottom content correctly, ie extend the same column to which the object belongs.
Example with basic float:left and width:33%
http://jsfiddle.net/kurtko/4w8n1frr/
I have tried several methods:
1) Using columns with float:left, then insert items changing the order with PHP. From: 1,2,3,4,5,6,7,8,9 to 1,4,7,2,5,8,3,6,9.
http://jsfiddle.net/kurtko/adLL8gmn/
<div class="items">
<div class="column>
<div class="item-1">
<div class="item-4">
<div class="item-7">
</div>
<div class="column>
<div class="item-2">
<div class="item-5">
<div class="item-8">
</div>
</div>
This is a good method, but when I use responsive version with one column the order is incorrect.
2) Masonry. Masonry - Isotope has a custom layout mode called 'masonryColumnShift' but in current version 2 is disabled.
http://isotope.metafizzy.co/v1/custom-layout-modes/masonry-column-shift.html
3) Flexbox. Using:
http://jsfiddle.net/kurtko/7cu5jvrr/
.items {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: flex-start;
}
.item {
width: 33.3%;
}
Good results but not perfect. When an item changes its height a white space is created below the row.
Any ideas?
Thanks.