jQuery技术:将fancybox设置为在不同的fancybox close上打开

有没有办法设置一个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); } 

    请参阅JSFIDDLE

      以上就是jQuery教程分享将fancybox设置为在不同的fancybox close上打开相关内容,想了解更多jQuery开发(异常处理)及jQuery教程关注计算机技术网(www.ctvol.com)!)。

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/jquerytutorial/561407.html

      (0)
      上一篇 2021年2月4日
      下一篇 2021年2月4日

      精彩推荐