1

I'm trying to make my application of fancybox 2 as efficient as possible ...

At the moment, i have this HTML markup:

<a class="fancybox" href="cont/intra_1.jpg" data-fancybox-group="dd-intrascan-gal" title="Zfx Intrascan"><img src="cont/intra_1.jpg" alt="" /></a>
<a class="fancybox" href="cont/intra_2.jpg" data-fancybox-group="dd-intrascan-gal" title="Zfx Intrascan"><img src="cont/intra_2.jpg" alt="" /></a>
<a class="fancybox" href="cont/intra_3.jpg" data-fancybox-group="dd-intrascan-gal" title="Zfx Intrascan"><img src="cont/intra_3.jpg" alt="" /></a>
<a class="fancybox" href="cont/intra_4.jpg" data-fancybox-group="dd-intrascan-gal" title="Zfx Intrascan"><img src="cont/intra_4.jpg" alt="" /></a>
<a class="fancybox" href="cont/intra_5.jpg" data-fancybox-group="dd-intrascan-gal" title="Zfx Intrascan"><img src="cont/intra_5.jpg" alt="" /></a>

which is quite lengthy and references the same image twice, once for thumbnails scaled down by CSS, once for the full image (this makes sense as it is an offline prensentation tool).

I then apply this JS to it (i shortened the configuration as it has no specific relevance to the question):

$('.fancybox')
.fancybox({
    helpers : { title : { type : 'over' } }
    }
});

This opens a fancybox popup where i can slide through all images within the "dd-intrascan-gal" group.

What i'd like to do is kind of this markup:

<img class="fancybox" src="cont/intra_1.jpg" rel="dd-intrascan-gal" title="foo">
<img class="fancybox" src="cont/intra_2.jpg" rel="dd-intrascan-gal" title="foo">
<img class="fancybox" src="cont/intra_2.jpg" rel="dd-intrascan-gal" title="foo">
<img class="fancybox" src="cont/intra_2.jpg" rel="dd-intrascan-gal" title="foo">

and do the rest by some kind of function or built in option of fancybox 2 ... There is the option of writing a specific function and run it before initialising fancybox, but maybe there is a more easy option built in that i'm not able to find?

kapitel4
  • 75
  • 7
  • 1
    I wrote this solution http://stackoverflow.com/a/9244921/1055987 for fancybox v1.3.4, but you could tweak it to use the proper v2.x API options. – JFK Jan 31 '13 at 18:01
  • possible duplicate of [Fancybox gallery without a href?](http://stackoverflow.com/questions/9240436/fancybox-gallery-without-a-href) – JFK Jan 31 '13 at 18:01
  • Thank you - i found that code and am trying to adjust it to fancybox 2 (to no success so far, but it will ...). I just was wondering if v2 might have a built in solution for this. – kapitel4 Feb 01 '13 at 10:37
  • 1
    Sorry, I was feeling lazy. I wrote the code for v2.x here http://stackoverflow.com/a/14823664/1055987 – JFK Feb 12 '13 at 00:45

0 Answers0