Using Fancybox version 2 - When Closing 2nd fancybox reopen first fancybox instead of simply closing

后端 未结 1 657
小鲜肉
小鲜肉 2021-01-16 03:40

Using Fancybox version 2 supplied by http://fancyapps.com/fancybox/#support

I want to open a fancybox from my main page, but within that 1st fancy box a second fancy

1条回答
  •  梦毁少年i
    2021-01-16 04:36

    You could create two scripts, one for each link so in the main page you have:

    1st Fancy Box
    

    Notice that class is now fancybox1 ... then the script tha fires the first fancybox.

    $(".fancybox1").fancybox();
    

    Inside 1stFancyBox.html you can have this link

    2nd FancyBox
    

    Notice that class is now fancybox2

    Also in the main page add the script that fires the second fancybox (from within the first fancybox):

    $(".fancybox2").fancybox({
     afterClose: function(){
      $(".fancybox1").trigger("click");
     }
    });
    

    The script above will fire the first fancybox after closing the second fancybox regardless the content of 2ndFancyBox.html.

    UPDATE: I added a DEMO here

    0 讨论(0)
提交回复
热议问题