使用滤镜选项(uikit),我们可以将img马赛克放在display:none中,但是如何从update插件中从index灯箱lightgallery.js中呢?

JS:

var $lg = $('.js-filter');
$lg.lightGallery({thumbnail: false});

// $lg.data('lightGallery').destroy(true);  ???


JSFIDDLE

谢谢!

最佳答案

我认为您可以挂接到uikit筛选器事件,以破坏并触发一个新画廊:

// Gallery container
var $lg = $('.js-filter');

// Initialize the gallery for all the elements
$lg.lightGallery({
  selector: 'li',
  thumbnail: false
});

// After uikit filter is applied
$('[uk-filter]').on('afterFilter', function() {

  // Destoy the previously created gallery
  $lg.data('lightGallery').destroy(true);

  // Initialize new gallery with just the visible items
  $lg.lightGallery({
    selector: 'li:visible',
    thumbnail: false
  });

});

10-02 11:54