Javascript 将fancybox设置为在其他fancybox关闭时打开
有没有办法将fancybox设置为在单独的fancybox关闭时打开? 我试过以下方法Javascript 将fancybox设置为在其他fancybox关闭时打开,javascript,jquery,fancybox,Javascript,Jquery,Fancybox,有没有办法将fancybox设置为在单独的fancybox关闭时打开? 我试过以下方法 $('a.linkEditClass').fancybox({ href: "#editClassPanel", closeClick: false, autoDimensions: true, autoScale: false, afterClose: function() { $.fancybox({
$('a.linkEditClass').fancybox({
href: "#editClassPanel",
closeClick: false,
autoDimensions: true,
autoScale: false,
afterClose: function() {
$.fancybox({
href: "#classInfoPanel"
});
}
});
但这似乎没什么作用。这是我的另一个fancybox代码供参考
$('a#linkClassInfo').fancybox({
href: "#classInfoPanel",
// maxHeight: 350,
// maxWidth: 425,
closeClick: false,
autoDimensions: false,
autoScale: false
});
它们都以div为目标。当您关闭fancybox时,它需要一段时间来清理并完成关闭过程,因此,在清理过程运行时打开另一个fancybox可能会触发js错误,使第二个框无法打开 只要给它一点时间,它就会工作得很好
afterClose: function () {
// wait for this box to close completely before opening the next one
setTimeout(function () {
$.fancybox({
href: "#classInfoPanel"
});
}, 300);
}
请参见