I have a select-box that contains 4 options, selecting each of which will result in removing all the present .item
divs and loading new .items
and then realigning them using isotope.
$('.menu-select').change(function(){
var selected=$('.menu-select-option:selected').html().toLowerCase();
if(selected=='all')
{
loadContent('mixed_home_all.html');
}
if(selected=='recommended')
{
loadContent('mixed_home_reco.html');
}
if(selected=='popular')
{
loadContent('mixed_home_pop.html');
}
});
The loadContent function looks like this :
function loadContent(filename){
var $item=$('.item');
$container.isotope('remove', $item);
$container.load(filename, function(){
$container.imagesLoaded(function(){
$container.isotope('reLayout');
});
});
}
FOr some reason, reLayout
is not working. The class isotope-item
is not getting added to the individual items either. THere's no error in the console log.