Search code examples
jqueryfancybox

How/where to define fancybox defaults?


Let's say this is my fancybox config:

   $(".fancybox").fancybox({
      'transitionIn':'fade',
      'transitionOut':'fade',
      'speedIn':150,
      'speedOut':150,
      'changeSpeed':150,
      'changeFade':150,
      'overlayOpacity':0.1,
      'overlayColor':'#000000',
      'padding':0,
      'margin':20,
      'titleShow':false,
      'centerOnScroll':true
   });

But, what I would like to do, is to somehow define the config as the fancybox default, so that consequently when I bind an element, I can only do this:

$(".newElement").fancybox();

And it will automatically have my config.


Solution

  • According to the documentation here: http://fancybox.net/api

    You can pass options as key/value object to fancybox() function or modify them at the bottom of FancyBox JS file