Open fancybox 3 into iframe parent

匆匆过客 提交于 2019-12-02 11:34:33

I hope you red the docs while doing "many researches". From the docs:

To access and control fancybox in parent window from inside an iframe:

// Adjust iframe height according to the contents
parent.jQuery.fancybox.getInstance().update();

This should give you a clue that you can use parent.jQuery.fancybox to use API from the parent page.

Then, API section should give you a clue how to open image gallery programmatically:

$.fancybox.open([
    {
        src  : '1_b.jpg',
        opts : {
            caption : 'First caption',
            thumb   : '1_s.jpg'
        }
    },
    {
        src  : '2_b.jpg',
        opts : {
            caption : 'Second caption',
            thumb   : '2_s.jpg'
        }
    }
], {
    loop : false
});

So, combining these two snippets should give you the answer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!