Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将fancybox设置为在其他fancybox关闭时打开_Javascript_Jquery_Fancybox - Fatal编程技术网

Javascript 将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({

有没有办法将fancybox设置为在单独的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);
}
请参见