Search code examples
phpjqueryhtmlfancybox

How to open fancybox gallery with group photos via <a href=""> button?


I have in array images that are grouped by id of the gallery and inside are images that belong to that gallery. i need somehow to append images to the same fancybox group and call this action via single unique <a href="javascript:void(0);"> button.

Version: fancyBox v2.1.5

<a class="grouped_elements" rel="group1" href="javascript:void(0);"><?= $this->trans->btn['title']; ?></a>

This is the button i have several button in foreach loop that need to be unique. fancybox css and js are already included in the html

<a class="grouped_elements" rel="group1" href="javascript:void(0);"><?= $this->trans->btn['title']; ?></a>

Solution

  • fancybox v2 uses data-fancybox-hrefor href attribute as the source and data-fancybox-group or rel attribute as group name.