将fancybox设置为在其他fancybox关闭上打开 [英] Set fancybox to open on a different fancybox close
问题描述
是否有一种方法可以将花式盒子设置为在关闭单独的花式盒子时打开? 我尝试了以下
Is there a way to set a fancybox to open whenever a separate fancybox closes? I have tried the following
$('a.linkEditClass').fancybox({
href: "#editClassPanel",
closeClick: false,
autoDimensions: true,
autoScale: false,
afterClose: function() {
$.fancybox({
href: "#classInfoPanel"
});
}
});
但是,这似乎没有任何作用.这是我的其他fancybox代码供参考
But this doesn't seem to be doing anything. Here is my other fancybox code for reference
$('a#linkClassInfo').fancybox({
href: "#classInfoPanel",
// maxHeight: 350,
// maxWidth: 425,
closeClick: false,
autoDimensions: false,
autoScale: false
});
它们都针对div.
推荐答案
关闭fancybox时,它需要花费一些时间来清理并完成关闭过程,因此,在清理过程运行时打开另一个fancybox可能会触发js错误,导致第二个框无法打开.
When you close fancybox, it takes a little while for it to clean up and complete the closing process so, opening another fancybox while the clean up process is running may trigger a js error that voids the second box from opening.
只需花一点时间,它应该可以正常工作
Just give it a little bit of time and it should work so
afterClose: function () {
// wait for this box to close completely before opening the next one
setTimeout(function () {
$.fancybox({
href: "#classInfoPanel"
});
}, 300);
}
请参见 JSFIDDLE
See JSFIDDLE
这篇关于将fancybox设置为在其他fancybox关闭上打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!