I have a basic layout with flexbox.
CSS:
.grid {
display: flex;
flex-wrap: wrap;
}
.element-item {
flex-direction: row;
width: calc(100% / 2);
}
.element-item img {
width: 100%;
height: 16em;
object-fit: cover;
}
HTML:
<div class="grid">
<div class="element-item taxonomy">
<img class="attachment-post-thumbnail" src="image-1.jpg" alt="image-1" />
<h3>Title</h3>
<h5>Taxonomy</h5>
</div>
...
</div>
All good, the button filter navigation is working too. But when I init Isotope in my .js file, the whole layout collapses, the images disappear and everything is stacked on top of each other.
jQuery::
// init Isotope
var $grid = $('.grid').isotope({
// options
itemSelector: '.element-item',
});
// filter items on button click
$('.filter-button-group').on( 'click', 'button', function() {
var filterValue = $(this).attr('data-filter');
$grid.isotope({ filter: filterValue });
});
Doesn't Isotope "work" well with Flexbox? Or am I missing some Isotope jQuery option. Or haven't I been precise enough with the Flexbox properties?
Thanks.
jsfiddle by request https://jsfiddle.net/Lyqdguvz/