Reputation: 2735
The Isotope grid is wrong the first time I access to it. There are two screen captures to compare.
This can be seen at: http://telmo.club/merz/
Isotope js init:
init: function() {
// init Isotope
var $grid = $('.grid').isotope({
// options
layoutMode: 'fitRows',
});
// filter items on button click
$('.filter-button-group').on( 'click', 'a', function() {
var filterValue = $(this).attr('data-filter');
$grid.isotope({ filter: filterValue });
$('.grid').isotope({
hiddenStyle: {
opacity: 0
},
visibleStyle: {
opacity: 1
}
});
});
}
What am I doing wong? Thanks in advance
Upvotes: 1
Views: 1290
Reputation: 588
Put your codes inside $(window).load()
:
$(window).load(function () {
var $grid = $('.grid').isotope({
// options
layoutMode: 'fitRows',
});
// filter items on button click
$('.filter-button-group').on( 'click', 'a', function() {
var filterValue = $(this).attr('data-filter');
$grid.isotope({ filter: filterValue });
$('.grid').isotope({
hiddenStyle: {
opacity: 0
},
visibleStyle: {
opacity: 1
}
});
});
});
Upvotes: 2