开发者

loading fancybox on page load + specific options of fancybox

I know the only way to trigger fancybox on page load is to simulate a click of a hidden link, however the problem is that it seems that this click launches the fancybox with the default options and not taking into consideration the options I've givem... For instance:

$("a.albumPhoto").fancybox({
    'transitionIn'  :   'elastic',
    'transitionOut' :   'elastic',
    'speedIn'       :   600, 
    'speedOut'      :   200, 
    'modal' :   true,
     'onStart'  : 开发者_JAVA百科function(){}
});

 $("#albumPhoto_1").fancybox().trigger('click');

I have links with class albumPhoto and the first image is with ID albumPhoto_1, so I trigger it automatically on page load as shown above. However the first image does not take the options mentioned above:

'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'speedIn' : 600, 'speedOut' : 200, 'modal' : true, 'onStart' : function(){} Does anybody know how I can resolve this?

Thanks in advance!


You could try:

 $("#albumPhoto_1").trigger('click');

Because with the code you showed, you're calling the plugin again without options.
Hope this helps. Cheers

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜