Answer the question
In order to leave comments, you need to log in
What could be the reason for disabling thumbs when linking fancybox and slick?
I'm trying to use fancybox to display images from a slick slider. Because to scroll through the slides, slick creates copies of the blocks, duplicates of the images from the copies got out in the thumbs. I tried to solve this problem in two ways.
The first is to use fade: true in the slick settings
The second is to overwrite the image categories for the gallery when initializing the slider
_sliderNav.on('init', function(event, slick){
var line = slick.$slideTrack,
slides = line.find('[data-slick-index]');
slides.each(function () {
var _this = $(this),
fancyId = _this.find('[data-fancybox]'),
index = _this.index();
fancyId.attr('data-fancybox', 'cert' + index);
});
});
Answer the question
In order to leave comments, you need to log in
In any case, the thumbs are no longer initialized, the thumbs call button and the events on it disappear. What could be the reason?
<div class="item" data-index="2">
<a href="/data/himg/booking1395_1.jpg" data-fancybox="images-tour"><img
class="owl-lazy" width="932" height="619" src=""
data-src="/data/himg/booking1395_1.jpg"
alt=""></a>
</div>
var owl = $('.slider'); //слайдер еще без клонов
$links = owl.find('a'); // ссылки. Тут не должно быть клонированных ссылок
/*
'click.fb-start' нашел полазив в плагине.
При переходе по ссылке с hash, скрипт находит дата атрибут с названием как в хеш, и тригает на нем это событие
'.item a' для того, что бы клик нормально работал и на клонах.
*/
owl.on('click.fb-start', '.item a', function (e) {
e.preventDefault();
var index = $(this).parent('.item').data('index');
$.fancybox.open($links, {
arrows: true,
toolbar: true,
loop: true,
buttons: [
"slideShow",
"fullScreen",
"thumbs",
"close"
],
hash: 'images-tour' // хеш такой как в дата атрибуте
}, index); // по этому индексу в $links будет найдена ссылка
});
var $links = $(".Modern-Slider").slick('getSlick').$slides.find('a');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question