lightgallery ОБНОВЛЕНИЕ ИНДЕКСА - PullRequest
0 голосов
/ 16 мая 2018

С опцией фильтра (uikit) мы можем поместить мозаику img в display:none, но как мы можем update лайтбокс index из lightgallery.js плагина, пожалуйста?

JS:

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

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

JSFIDDLE

Спасибо!

1 Ответ

0 голосов
/ 16 мая 2018

Я думаю, что вы можете подключиться к событию фильтра 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
  });

});
...