K
K
kerptwotwo2022-04-12 19:02:59
JavaScript
kerptwotwo, 2022-04-12 19:02:59

Owl-carousel duplicates fancybox elements, how to disable?

In Owl-carousel I need infinite scroll but it interferes with fancybox gallery, is there any way around this?
6255a2a782269489322101.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kerptwotwo, 2022-04-17
@kerptwotwo

function addFancy(event) {
  var element = event.target;
  var id = $(element).attr('id');
  $(element).find(".owl-item.cloned a").each(function(indexCloned) {
    var $clonedElem = $(this);
    var link = $clonedElem.attr('href');
    $clonedElem.attr('data-fancybox-trigger', id);
    $clonedElem.attr('href', 'javascript:;');
    $clonedElem.removeAttr('data-fancybox');
    $(element).find(".owl-item:not(.cloned) a").each(function(indexReal) {
      if (link === $(this).attr('href')){
        $clonedElem.attr('data-fancybox-index', indexReal);
      }
    });
  });
}

I
imko, 2022-04-12
@imko

With pens, just throw a pack of only the ones you need into it, and then find the clones and tell them to open the originals. In general, read the docks)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question