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.
This is how I do it (according to the latest (fancybox3) documentation):
$.fancybox.defaults.clickOutside = 'close'
$.fancybox.defaults.slideShow = {
autoStart : false,
speed : myGallerySlideshowSpeed
}
And so on. That is, I dont really initiate anything, I just have my items tagged data-fancybox="gallery"
and use the above code to set defaults.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With