I have 2 fancyboxes and am trying to open the second from the first (either by button or by closing the first)..
<div id="firstFancybox" style="display:none">
<p>I'm the first Fancybox!</p>
<a id="fancyboxButton" href="#secondFancybox">Close first Fancybox</a>
</div>
<a id="hiddenLink" href="#firstFancybox"></a>
<div id="secondFancybox" style="display:none">
<p>I'm the second Fancybox!</p>
</div>
The first Fancybox is being activated on page load..
$(document).ready(function() {
$("a#hiddenLink").fancybox({ 'hideOnContentClick': false, 'frameWidth': 300, 'frameHeight': 300 }).trigger('click');
$("a#fancyboxButton").fancybox();
});
I want to be able to open the second fancybox whenever the first one is closed. Or.. open the second one from clicking the button in the first.
How is this achieved? I'm not having much luck binding to events i'm afraid.
-- Lee
UPDATE :
Using callbackOnClose is allowing me to do simple stuff, like alert('hi'), but i've not managed to open another Fancybox yet.
$(document).ready(function() {
$("a#hiddenLink").fancybox({ 'hideOnContentClick': false, 'frameWidth': 300, 'frameHeight': 300,
callbackOnClose: function() { alert('hi'); }
}).trigger('click');
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…