I have 2 fancyboxes and I'm trying to open the second of 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 activated when the page loads.
$(document).ready(function() { $("a#hiddenLink").fancybox({ 'hideOnContentClick': false, 'frameWidth': 300, 'frameHeight': 300 }).trigger('click'); $("a#fancyboxButton").fancybox(); });
I want to open the second fancybox whenever the first is closed. Or .. open the second by clicking the button in the first.
How is this achieved? I am not very lucky with the events that I fear.
- Lee
UPDATE:
Using callbackOnClose allows me to do simple things like alert ('hi'), but I have not yet been able to open another Fancybox.
$(document).ready(function() { $("a#hiddenLink").fancybox({ 'hideOnContentClick': false, 'frameWidth': 300, 'frameHeight': 300, callbackOnClose: function() { alert('hi'); } }).trigger('click'); });
source share