简体   繁体   English

从主要网站在iframe中启动的FancyBox画廊仅影响iframe吗?

[英]FancyBox gallery launched in iframe from main site affects only iframe?

I got a website with a basic structure of six main sites, each of those having a number of submenues. 我有一个网站,该网站的基本结构包含六个主要站点,每个站点都有许多子菜单。 These subsites are loaded into the current main page via an iframe and javascript. 这些子网站通过iframe和javascript加载到当前主页中。 I have a lot of pictures on these submenu sites and I thought I'd give the Fancybox a try. 这些子菜单网站上有很多照片,我想尝试一下Fancybox。

I loaded the css and javascript file into the submenu site, defined the picture as stated: 我将css和javascript文件加载到子菜单站点中,按如下所示定义图片:

<a class="fancybox-systa" data-fancybox-group="wat" href="pics/big/b1.jpg" title="Lorem ipsum dolor sit amet"><img src="pics/small/s1.jpg" alt="" /></a>

and included the launch script on the site also: 并在网站上添加了启动脚本:

<script type="text/javascript">
            $(document.ready(function() {
            $('.fancybox-systa').fancybox({
                helpers: {
                    title : {
                        type : 'inside'
                    }}});   
        });
    </script>
    <style type="text/css">
        .fancybox-custom .fancybox-skin {
            box-shadow: 0 0 50px #222;
        }
    </style>

It works fine, but it only affects the iframe, I would like my gallery to affect the entire parent window, so that the entire windows fades out, not only the small iframe compartement. 它可以正常工作,但只影响iframe,我希望我的图库影响整个父窗口,以便整个窗口淡出,而不仅仅是小iframe隔间。

I have tried to call the function like this: 我试图像这样调用函数:

$(parent.document.ready(function() {

and many other similar forms, but unfortunately, none of those did the trick. 和许多其他类似的形式,但不幸的是,这些都没有达到目的。

I'd really appreciate any tips on this. 我真的很感谢任何提示。

Best regards, Alex 最好的问候,亚历克斯

Yes. 是。 FancyBox is available inside document that is loaded into IFRAME. FancyBox在加载到IFRAME中的文档内部可用。 The same occurs to frames. 帧也一样。 So you need to initialize it everywhere. 因此,您需要在任何地方初始化它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM