Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

isotope - 'no results' message? [closed]

I'm using the Isotope JS plugin (v2.0.1) from Metafizzy to filter a library of publications, and I am using more than one filter (e.g. publisher and industry). Is there a way to check if my combination of filters has resulted in zero results, and then show a corresponding message... something like "Sorry. No matching items found."

like image 674
BellamyStudio Avatar asked Nov 04 '11 10:11

BellamyStudio


1 Answers

$container.isotope({ filter: '.your-filter' });

  if ( !$container.data('isotope').$filteredAtoms.length ) {
    $('.message-div').fadeIn('slow');
  } else {
    $('.message-div').fadeOut('fast');
  }

You could also use hide/show or a number of other effects instead of fadeIn and fadeOut depending on your effect.

like image 145
jayjo Avatar answered Sep 29 '22 17:09

jayjo