下面是一个代码片段你
脚本:
<script>
$(document).ready(function()
{
$("a#MyBox1").fancybox({ 'hideOnContentClick': false, 'frameWidth': 400, 'frameHeight': 400,
callbackOnClose: function() { window.setTimeout('open2()',100); }
}).trigger('click');
});
function open2(){
$("a#MyBox2").fancybox().trigger('click');
}
</script>
HTML:
<div id="firstFancybox" style="display:none">
<p>I'm the first Fancybox!</p>
<a href="#" onclick="open2();">Close first Fancybox</a>
</div>
<a id="MyBox1" href="#firstFancybox"><!--for first fancy box--></a>
<div id="secondFancybox" style="display:none">
<p>I'm the Second Fancybox!</p>
</div>
<a id="MyBox2" href="#secondFancybox"><!--for second fancy box--></a>
[使用的fancybox 2版的可能重复 - 闭幕时第二个fancybox重新打开第一个fancybox而不是简单地关闭](http://stackoverflow.com/questions/10973380/using-fancybox-version-2-when-closing-2nd-fancybox-reopen-first-fancybox-inste) – JFK 2013-05-01 06:49:20