0

Can someone help me in adding multiple selectors if possible in

$().fancybox({
    selector : '.imglist a:visible'
});

eg

$().fancybox({
    selector : '.imglist a:visible, .owl-item'
});

regards,

1 Answers1

0

Your last snippet works perfectly fine, it is a valid selector - https://api.jquery.com/multiple-selector/

If you have any issue, then, please, create a live demo so it would be possible to investigate your problem and to give a helpful answer.

Janis
  • 8,593
  • 1
  • 21
  • 27
  • Thank you, this is working properly as you suggested. It seems the problem I have is the grouping is not working for some reason. If I have one gallery on a page it works fine, however if I have multiple galleries the data-fancybox="gallery" is ignored and all photos are grouped together regardless of the value in the data-fancybox. – Mellowtothemax Dec 14 '18 at 13:57
  • Sorry, but this is how it works - using `selector` creates one big gallery from all elements that matches the selector. – Janis Dec 14 '18 at 14:04
  • Maybe I didn't explain it properly as this is the what I am trying to achieve https://codepen.io/mellowtothemax/pen/VqeNEP. Here using selector and different data-fancybox values does group them properly. – Mellowtothemax Dec 14 '18 at 14:32
  • Oh I see what you mean, the selector comma is not an or logical operator. Is there a way to achieve what I am after? – Mellowtothemax Dec 14 '18 at 14:35
  • For a demo using OwlCarousel2, see answer here - https://stackoverflow.com/questions/53759044/fancybox-with-owl-carousel-lazyload – Janis Dec 17 '18 at 10:27
  • Thanks, got it sorted. I managed to use ('[data-fancybox^="gallery"]') for multiple galleries on same page and use selector only for specific galleries like isotope. Unfortunately I use owlcarousel1 and the cloned class only exists in owlcarousel2. – Mellowtothemax Dec 18 '18 at 11:10