【发布时间】:2011-10-17 21:41:25
【问题描述】:
我遇到了 Fancybox 窗口的问题。我使用fancybox 在我的页面上显示隐藏的div 的内容(下面的“.popup”fancybox)。在该内容中,有一个指向名为#exemple 的新fancybox 内容的链接。当我单击第一个 fancybox 中的链接时,它会加载第二个 fancybox 内容(iframe - 这很好用)。但是当用户点击第二个fancybox的关闭按钮时,我想回到第一个fancybox。
我尝试了“onClosed”事件,但它不起作用......
有没有办法做到这一点?
提前感谢您的帮助!
这是我使用的代码:
$("#exemple").fancybox({
'width' : '100%',
'height' : '100%',
'titleShow' : true,
'titlePosition' : 'over',
'titleFormat' : formatTitle,
'autoScale' : false,
'centerOnScroll' : true,
'type' : 'iframe',
'onClosed' : function() {
alert('test');
$(".popup").trigger('click');
}
});
$(".popup").fancybox({
'autoScale' : false,
'centerOnScroll' : true
});
// and here is the HTML code to trigger the hidden div:
<a style="font-weight: bold;" href=#data class=popup>our data</a>
//and the HTML code of the link inside the hidden div that gets displayed in the fancybox:
<a id=exemple title="xxx" href=xxx.php?id=xxx>link</a>
【问题讨论】:
-
你能做一个jsfiddle吗?
标签: javascript fancybox