0

I don't know much about Fancybox, and I'm confused about all the files. I think I have an easy question, but I can't seem to find the answer online. Must be so easy no one ever asks, or I'm not good at searching online.

I'm using Fancybox with an iframe, and was wondering how I could the stuff that's outside of the fancybox to be all black? I only want the iframe to be visible, or maybe make the outside 90% black. Where would I do this? In what file? There are so many files.

I have another question. How can I make the iframe close by clicking anywhere? I remember it was like this at first, and then I changed it so that it only closes by clicking on the X. I don't remember what file I modified. :/

Thank you!

4

2 回答 2

1

假设您使用以下 html 打开fancybox:

<a href="page.html" class="fancybox">open page</a>

无需修改任何文件,只需将正确的选项(对于 fancybox v1.3.4)添加到您的自定义脚本中,例如:

$(".fancybox").fancybox({
 "overlayColor": "#000",  // here you set the background black
 "overlayOpacity": 1,  // here you set the transparency of background: 1 = opaque
 "hideOnOverlayClick": true,  // if true, closes fancybox when clicking OUTSIDE the box
 "hideOnContentClick": true, // if true, closes fancybox when clicking INSIDE the box
 "type": "iframe" // the type of content : iframe for external pages
 "width": 640, // if type=iframe is always smart to set dimensions
 "height": 320
});

请注意,Boolean和/或integer值不应该有引号

有关其他选项,请阅读文档

于 2012-04-13T01:03:08.947 回答
0

如果您使用的是fancybox V2

你可以在这个文件中看到:jquery.fancybox.css

寻找 :

    /* Overlay helper */

#fancybox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    display: none;
    z-index: 1001;
    background: #000;
}

添加:

opacity: 1 !important; 

不透明度是一个双值,所以如果你想要 90% 的不透明度,它是:0.90

于 2012-04-12T18:19:15.713 回答