I have nice gallery with lots of pictures in one page and am using Fancybox to nicely show them in groups using different "rel" attributes. But I want to make a "view all" option to ignore the "rel" and to join them all in one group. I don't want to change the HTML with js, as I have more than 100 images and it would not be efficient. Also I would like to avoid building an array of items to tell Fancybox to show (for the same reason). So is there a way I could trick Fancybox to group not by "rel", but maybe by certain class, or other attribute?
My (very simplified) HTML looks like:
<div class="gallery">
<a rel="group1" class="showall" href="image01-full.jpg"><img src="image01.jpg"/></a>
<a rel="group1" class="showall" href="image02-full.jpg"><img src="image02.jpg"/></a>
<a rel="group2" class="showall" href="image03-full.jpg"><img src="image03.jpg"/></a>
<a rel="group2" class="showall" href="image04-full.jpg"><img src="image04.jpg"/></a>
<a rel="group3" class="showall" href="image05-full.jpg"><img src="image05.jpg"/></a>
<a rel="group3" class="showall" href="image06-full.jpg"><img src="image06.jpg"/></a>
</div>
I target my images in the simplest form:
$('.gallery a').fancybox();
So my images are then grouped by rel in like 3 groups if in this example. Can I group them by telling to group by class "showall", or something? Or the only way is to build the data array of all items and feed it as an option when I need it?
Thank You!
fancybox-2
tag ;) – JFK$.fancybox.open( $('.showall'), [options] )
. The problem was to setindex
option dynamically, otherwise API method disregards which image you have clicked and starts from the first one. – donatasben