Artur Haddad
Artur Haddad

Reputation: 1529

How to use fancybox button helper + fancybox thumbnail helper?

I need to use both of them simultaniously (fancybox button helper and thumbnail helper)

I can only use one of them at a time.

These are the examples of each function: http://fancyapps.com/fancybox/#examples

Already tried using the two classes:

<a class="fancybox-buttons fancybox-thumbs"    

But it doesn't work... only one at a time, like:

<a class="fancybox-buttons"    

or

<a class="fancybox-thumbs"     

.

These are the javascripts of each:

            /*
            Button helper. Disable animations, hide close button, change title type and content
        */

        $('.fancybox-buttons').fancybox({
            openEffect  : 'none',
            closeEffect : 'none',

            prevEffect : 'none',
            nextEffect : 'none',

            closeBtn  : false,

            helpers : {
                title : {
                    type : 'inside'
                },
                buttons : {}
            },

            afterLoad : function() {
                this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
            }
        });


        /*
            Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
        */

        $('.fancybox-thumbs').fancybox({
            prevEffect : 'none',
            nextEffect : 'none',

            closeBtn  : false,
            arrows    : false,
            nextClick : true,

            helpers : { 
                thumbs : {
                    width  : 50,
                    height : 50
                }
            }
        });

    });    

Thanks

Upvotes: 3

Views: 27704

Answers (1)

JFK
JFK

Reputation: 41143

You only need a single script to use both so with a single class in your html should work like

<a class="fancybox" ...

then the script:

$('.fancybox').fancybox({
 openEffect  : 'none',
 closeEffect : 'none',
 prevEffect : 'none',
 nextEffect : 'none',
 closeBtn  : false,
 arrows    : false,
 nextClick : true,
 helpers : {
  title : {
   type : 'inside'
  },
  buttons : {},
  thumbs : {
   width : 50,
   height : 50
  }
 },
 afterLoad : function() {
  this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
 }
});

Upvotes: 8

Related Questions