如何在fancyBox v2中更改覆盖颜色 [英] How can I change the overlay color in fancyBox v2
问题描述
在fancyBox版本1中,有一个overlayColor
参数,但是在版本2中,它似乎不再起作用.
In fancyBox version 1 there was the overlayColor
parameter, but in version 2 it doesn't seem to work anymore.
编辑CSS不起作用,因为它已被插件中的JavaScript覆盖.
Editing the CSS doesn't work because it gets over-written by the JavaScript in the plugin.
有什么想法吗?
推荐答案
Fancybox v2.x API选项是新的,并且与以前的版本不兼容,因此overlayColor
已由helpers
=> overlay
=代替> css
=> background-color
选项.
Fancybox v2.x API option are new and are not compatible with previous versions so overlayColor
has been replaced by the helpers
=> overlay
=> css
=> background-color
option.
您不必弄乱,就像@ Sparky672所建议的那样(原始的(js或css)文件)(这是一个错误的惯例想法).您可以在自定义脚本中设置该选项...例如,使用以下html
You don't have to mess with the original (js or css) files either as suggested by @Sparky672 (that is a bad practice idea). You can set that option in your custom script ... so having this html for instance:
<a class="fancybox" href="images/01.jpg">open fancybox with a red overlay</a>
使用自定义脚本,例如:
use a custom script like:
$(".fancybox").fancybox({
helpers : {
overlay: {
opacity: 0.8, // or the opacity you want
css: {'background-color': '#ff0000'} // or your preferred hex color value
} // overlay
} // helpers
}); // fancybox
这篇关于如何在fancyBox v2中更改覆盖颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!