Closed SynCap closed 7 years ago
I guess this is due to your code structure. You are trying to create an "a" element around block level elements.
Therefore browser tries to fix your code by duplicating links and if you would use developer tools, you would see that browser renders your code like this -
<p>
<a class="mix type-ec" href="k.jpg" data-myorder="0" data-fancybox="gallery-ec" data-caption="<h4>EC 02</h4>"></a>
</p>
<div class="col-lg-3 col-md-4 col-sm-6">
<a class="mix type-ec" href="k.jpg" data-myorder="0" data-fancybox="gallery-ec" data-caption="<h4>EC 02</h4>">
<img src="m.jpg" alt="img">
</a>
<div class="figcaption">
<a class="mix type-ec" href="k.jpg" data-myorder="0" data-fancybox="gallery-ec" data-caption="<h4>EC 02</h4>">
<h4>EC 02</h4>
<p class="price"><span>от </span>8 795 <span>₽</span></p>
</a>
<a href="#modalForm" data-solution="ec-02" class="arctic">заказать</a>
</div>
</div>
In the end, fancyBox sees 3 links having the same data attributes.
This is how your code would work correctly - http://codepen.io/fancyapps/pen/XMPbXP?editors=1000
In the end, fancyBox sees 3 links having the same data attributes.
Could you add a check and reduce for unique items? I use fancybox in combination with a slider-plugin (owl.carousel or slick.carousel) which constanly clone my fancybox-items.
@asaage Simply initialise with correct selector, for example (for slick carousel):
$().fancybox({
selector : '.slick-slide:not(.slick-cloned)',
hash : false
});
@fancyapps Your demo doesn't work for all cases:
@asaage For slick carousel try something like this as an alternative: https://codepen.io/anon/pen/RYWbVY
We use the slick 'init' event to
Hmm, what a bummber... Yes, @f4w-pwharton, you are right, clicking cloned items would display all items :/
Your demo inspired me to create a more complete solution - https://codepen.io/fancyapps/pen/jvbEgo?editors=1010 - the idea is that clicking clones would trigger click event on corresponding original item. Although, this will work only with the upcoming (v3.4) version (should be released tomorrow).
Could you help me to get this working with the Swiper JS library. I have the same problem with duplicate slides and can't find a way to make it work.
It would be similarly to this - https://fancyapps.com/fancybox/3/docs/#faq-6 But, to overcome this issue properly, this project will be split into 3 parts, see Combine & Customize
section here https://fancyapps.com/next/
I've got a situation where all gallery images going a triple cloned in showcase mode. In initial markup all links are unique and all "href" are unique too, but in showcase mode all images multiplicates suddenly. In thumbnail bar they also occurs in a triple number.
All links looks like that:
All big images are shown by its correct "href" but triple. No initialization by JS code, just data attributes.
UPD: According to number of child DIVs inside a link, cause the adding corresponding number of same images into showcase. When I've replacing DIV to SPAN - all going OK.
It's a bug? Or is a feature?