I have 2 fancyboxes and am trying to open the second from the first (either by button or by closing the first)..
Ok, I finally got it to work (my first encounter with fancybox). It seems that callbackOnClose is called upon closing, not after closing. Hence the second fancybox cannot pop up until after the first one closed completely.
The trick? Delay the opening of the second one by using a timer. This is by no means the perfect answer, could behave oddly if timer is set too short, and not ideal if set too long. 100ms works for me. Here's the code.
Script:
$(document).ready(function() {
$("a#hiddenLink").fancybox({ 'hideOnContentClick': false, 'frameWidth': 300, 'frameHeight': 300,
callbackOnClose: function() { window.setTimeout('open2()',100); }
}).trigger('click');
});
function open2(){
$("a#fancyboxButton").fancybox().trigger('click');
}
HTML: