You can use jQuery Extend to combine the contents of two or more objects together.
Here's the config:
var fancyboxConfig = { '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 };
Then you can use it directly:
$(".newElement").fancybox(fancyboxConfig);
or merge / redefine them:
$(".newElementNoEffect").fancybox( $.extend({}, fancyboxConfig, { openEffect: 'none', closeEffect: 'none', }) );
Additional information: http://api.jquery.com/jQuery.extend/
Jaider
source share