duncanmcdougall / Responsive-Lightbox

Lightweight, image only responsive, jQuery lightbox plugin
https://www.belter.io/responsive-lightbox/
113 stars 47 forks source link

Grouping Galleries #16

Closed GoDsGiMp closed 10 years ago

GoDsGiMp commented 10 years ago

Thanks for a great script. It works great without adding a lot of extra stuff I don't need. However I'm trying to group galleries that are dynamically created within the my template files, this means I only have the gallery class name within each post and so can only run the script when I know the gallery ID.

In your group example the code is:

<script>
$(function() {
    $('.gallery1 a').lightbox();
    $('.gallery2 a').lightbox();
  });
</script>

But since I don't know my gallery class names until the post appears in the loop, I need to be able to do this:

<script>
$(function() {
    $('.gallery1 a').lightbox();
 });
</script>
<ul class="gallery1"><li><a href="image"></a></li></ul>
<script>
$(function() {
    $('.gallery2 a').lightbox();
 });
</script>
<ul class="gallery2"><li><a href="image"></a></li></ul>

If I try do that at the moment I get duplication of all the hidden content and overlap of images between the two galleries. Clicking next/prev sometimes loads from the first gallery and sometimes the second.

Thank you.