使用滤镜选项(uikit),我们可以将img马赛克放入display:none
,但是我们如何更新
灯箱index
来自 lightgallery.js
插件好吗?
JS:
var $lg = $('.js-filter');
$lg.lightGallery({thumbnail: false});
// $lg.data('lightGallery').destroy(true); ???
谢谢!
最佳答案
我认为您可以 Hook 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
});
});
关于javascript - lightgallery 更新索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50379096/