wordpress - jQuery Isotope plugin breaks layout when combination filters return no results and another correct set of filters is applied -


isotope handles filtering , layouting of wordpress posts. system works fine until no results found using filters, , applying correct set of filters right after that.

so problem is:

  1. as long results found (using filters) plugin works well.
  2. when no results found, , apply correct set of filters right after that, layout breaks.

i think isotope loses sense of width , / or height or that.

filters return no results:

filters return no results

filters return results again:

filters return results again

javascript:

jquery(window).load(function(){  var $container = jquery('#talot'),     filters = {};      $container.isotope({         itemselector : '.talo-item',         animationoptions: {             duration: 750,             easing: 'linear',             queue: false         }     });  $container.isotope('relayout');  // filter buttons jquery('.filter a').click(function(){     var $this = jquery(this);     // don't proceed if selected     if ( $this.hasclass('selected') ) {         return;     }      var $optionset = $this.parents('.option-set');     // change selected class     $optionset.find('.selected').removeclass('selected');     $this.addclass('selected');      // store filter value in object     var group = $optionset.attr('data-filter-group');     filters[ group ] = $this.attr('data-filter-value');     // convert object array     var isofilters = [];     ( var prop in filters ) {     isofilters.push( filters[ prop ] )     }     var selector = isofilters.join('');     console.log(selector);     $container.isotope({ filter: selector });  return false; });  }); 

i added console.log selector debugging , found problem way. appreciated!

if need more info, ask , provide needed. thank in advance code wizards!

one (at least partial) solution found myself setting min-height css-property item class. think it's bit dirty solution if can come "real one" feel free :)


Comments