I have several items arranged 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 use jQuery slidedown to show the contents of the hidden content of each item when clicked. I want to click the bottom content correctly, i.e. Extend the same column to which the object belongs.
Basic float example: left and width: 33%
http://jsfiddle.net/kurtko/4w8n1frr/
I tried several methods:
1) Using columns with float: left, then insert elements that reorder 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 the responsive single-column version, the order is wrong.
2) Freemasonry. Freemasonry - Isotope has a custom layout mode called "masonryColumnShift", but is disabled in current version 2.
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 element changes its height, free space is created under the line.
Any ideas?
Thanks.