justcode
justcode

Reputation: 417

All gallery images are being displayed by Fancybox

I'm using the fancy box 2, but when I click on the link to open the slideshow, all the images are shown at once. Sometimes it will add a scroll bar....see code below

http://jsfiddle.net/Tx3AF/

Sorry I couldnt add the fancyboox JS to show the gallery.. Any help will be appreciated...I have searched on the internet and no luck...

Thanks.

Upvotes: 0

Views: 630

Answers (1)

JFK
JFK

Reputation: 41143

if you are using this

$(".fancybox").fancybox({
    openEffect: 'none',
    closeEffect: 'none'
});​

then just add the class fancybox to all <a> tags that target an image of the same gallery.

Your first link

<a class="fancybox" href="#morephotos">This shows ...

should actually target the first image of the gallery

<a class="fancybox" href="firstImage.jpg" rel="gallery">This shows....

... otherwise will show whatever is inside the <div> with id="morephotos".

Don't forget to wrap your custom fancybox script within the .ready() method like

  $(document).ready(function(){
    $(".fancybox").fancybox({
        openEffect: 'none',
        closeEffect: 'none'
    });​ // fancybox
  }); // ready

Upvotes: 1

Related Questions