how to navigate fancybox to next picture and back to previous ?

how to navigate fancybox to next picture and back to previous ?


I have a non-typical question about jquery fancybox. I've got the following html:

 <a class="fancybox" rel="gallery1" href="content/img/img1.jpg" title=""> <img src="content/img/img1.jpg" alt="" /> </a> <a class="fancybox" rel="gallery1" href="content/img/img2.jpg" title=""> <img src="content/img/img2.jpg" alt="" /> </a> <a class="fancybox" rel="gallery1" href="content/img/img3.jpg" title=""> <img src="content/img/img3.jpg" alt="" /> </a>

That simple markup gets us some work done. after clicking the thumbnail which is an anchor element the picture appears. But I want it to work somewhat different - when I click the thumbnail I want the fancybox to show me next picture in a row and just after that to get back to the previous one, that was actually clicked. I know it is odd but it's client's request, you know :)

I am new to jquery that's why I got a problem with doing that part. My code goes like this:

 $(".fancybox").fancybox({ $(".fancybox").click(function(){$(".fancybox").next().prev() }); });

But that does not work. Guys please help me out with this.