views:

238

answers:

1

Hello,

I try to implement the JQuery Lightbox plugin with dynamic grouped of images (grouped in image popup), but i can not find the clue for popup grouped images.

Can someone tell me what i'm doing wrong?

HTML

<a href="pic1.jpg" class="pic" rel="lightbox1"><img src="pic1.jpg"/></a>
<a href="pic2.jpg" class="pic" rel="lightbox1"><img src="pic2.jpg"/></a>

<a href="pic3.jpg" class="pic" rel="lightbox2"><img src="pic3.jpg"/></a>
<a href="pic4.jpg" class="pic" rel="lightbox2"><img src="pic4.jpg"/></a>

<a href="pic5.jpg" class="pic" rel="lightbox3"><img src="pic5.jpg"/></a>
<a href="pic6.jpg" class="pic" rel="lightbox3"><img src="pic6.jpg"/></a>

JQUERY

jQuery(document).ready(function() {    
  $('a.pic').live('click', function() {
      var relvalue = $(this).attr('rel');
      $("a[rel="+relvalue+"]").lightBox();
  });
});

Thanks!

+1  A: 

Did you try this?

jQuery(document).ready(function() {    
  $('a.pic').lightBox();
});

I assumed you are using krewenki's jquery-lightbox. With $('a.pic').lightBox(); you give to a elements the lightbox ability and with rel attributes on a elements you're grouping them.

kara
Ok, i use another plugin as wrote in the comment above, but i think the jQuery-Lightbox from Warren Krewenki is easier and includes the possibility to group by the "rel" attribute. Thanks for the tip !
Guido Lemmens 2
No problem, if my answer solves your question, please accept it.
kara