Trying to figure how to prevent columns from moving when we have changed height of column. Look JSFiddle, try to click links in 3 column to see: https://jsfiddle.net/g305643f/1/
If you want to offer a solution with non multi columns - this task of building columns can be realized using other methods under the following condition:
On desktop we need this:
1 3 5
2 4
On tablet:
1 4
2 5
3
Didn't find solution with flex/float/inline-blocks so made it with multi-columns and now find this issue.
$(document).ready(function() {
$(".open").click(function(e){
$(this).next().slideToggle();
e.preventDefault();
});
});
.sections {
-webkit-column-gap:41px;
-moz-column-gap:41px;
column-gap:41px;
-moz-column-count: 3;
-webkit-column-count: 3;
column-count: 3;
}
.section {
-webkit-column-break-after: avoid;
-webkit-column-break-before: avoid;
break-inside: avoid;
-webkit-column-break-inside: avoid;
page-break-inside: avoid;
}
.open {
display: block;
text-transform: uppercase;
margin: 10px 0;
font-family: "Helvetica";
}
.hidden {
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="sections">
<div class="section">
<img src="http://placehold.it/300x300" />
</div>
<div class="section">
<img src="http://placehold.it/300x310" />
</div>
<div class="section">
<a href="#" class="open">Open & raise height</a>
<div class="hidden">
<img src="http://placehold.it/300x320" />
</div>
<img src="http://placehold.it/300x330" />
</div>
<div class="section">
<img src="http://placehold.it/300x340" />
</div>
<div class="section">
<a href="#" class="open">Open & raise height</a>
<div class="hidden">
<img src="http://placehold.it/300x320" />
</div>
<a href="#" class="open">Open & raise height</a>
<div class="hidden">
<img src="http://placehold.it/300x320" />
</div>
<img src="http://placehold.it/300x350" />
</div>
</div>