Isotope - filtered images - how to only show the visible (filtered) images in lightbox (or shadowbox JS)

让人想犯罪 __ 提交于 2019-12-04 15:36:40

Managed to fix this issue by adding the following code to the Javascript for ISOTOPE: This clears and reloads the cache after each filter, and means that only the images which are shown are displayed in Shadowbox:

    // filter buttons
    $('#filters a').click(function(){
      var selector = $(this).attr('data-filter');
      $container.isotope({ filter: selector });

      // don't proceed if no Shadowbox yet
      if ( !Shadowbox ) {
        return false;
      }

      Shadowbox.clearCache();

      $container.data('isotope').$filteredAtoms.each(function(){
        Shadowbox.addCache( $(this).find('a[rel^="lightbox"]')[0] );
      });

      return false;
    });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!