jQuery 从fancybox-inner div 中删除白色背景颜色

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10857251/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 09:50:43  来源:igfitidea点击:

Remove the white background-color from the fancybox-inner div

jqueryfancyboxfancybox-2

提问by JasonGroulx

Is there a way to remove the white background-color from the fancybox-inner div?

有没有办法从fancybox-inner div中删除白色背景色?

heres what i was trying..

继承人我正在尝试..

$(".fancybox").fancybox({padding : 0, background: 'none'});

回答by JFK

You can change it via an inline CSSdeclaration.

您可以通过内联CSS声明更改它。

After you linked to the fancybox cssfile add this:

链接到fancybox css文件后,添加以下内容:

   .fancybox-skin {
      background-color: #ff0000; /* or whatever */
    }

The default values for that selector are:

该选择器的默认值为:

.fancybox-skin {
    background: none repeat scroll 0 0 #F9F9F9;
    border-radius: 4px 4px 4px 4px;
    color: #444444;
    margin: 0;
    padding: 0;
    position: relative;
    text-shadow: none;
}

eventually, you can change the background-colorwithin your script using the beforeShowcallback option like:

最终,您可以background-color使用beforeShow回调选项更改脚本中的 ,例如:

$(".fancybox").fancybox({
 beforeShow: function(){
  $(".fancybox-skin").css("backgroundColor","transparent");
 }
});

NOTICEthat I used transparentif you want to removeit (noneis not a valid value in this case)

transparent如果您想删除它,请注意我使用它(none在这种情况下不是有效值)

回答by mrzmyr

http://fancyapps.com/fancybox/#helpers

http://fancyapps.com/fancybox/#helpers

In Version 2 there is a way through the helpers:

在第 2 版中,有一种通过助手的方法:

$(".fancybox").fancybox({
    helpers:  {
        overlay : {
            css : {
                'background-color' : '#fff'
            }
        }
    }
});

回答by Moisey Uretsky

You should be able to add an additional class to the fancybox-inner div like:

您应该能够向fancybox-inner div 添加一个额外的类,例如:

class="white"

And then just set it there:

然后将其设置在那里:

background: #FFF;

And it will override the default.

它将覆盖默认值。