Fancybox 包装器无法根据图像尺寸正确自动调整大小
我在使用 FancyBox 时遇到问题。它应该根据图像的尺寸自动调整包装器的大小。它不是这样做的。具体来说就是太小了。
这是我使用过的 FancyBox jQuery 代码:
$("a[rel=photo_gallery]").fancybox({
'type' : 'image',
'padding' : 10,
'autoScale' : true,
'cyclic' : true,
'overlayOpacity' : 0.7,
'overlayColor' : '#000000',
'transitionIn' : 'fade',
'transitionOut' : 'fade',
'titlePosition' : 'over',
'titleShow' : false,
'resize' : 'Auto'
});
还有其他人遇到过这个问题吗?
预先感谢您的任何帮助。
I'm having an issue with FancyBox. It's supposed to auto-resize the wrapper in accordance to the dimensions of the image. It's not doing that. Specifically it's too small.
Here's the FancyBox jQuery code I've used:
$("a[rel=photo_gallery]").fancybox({
'type' : 'image',
'padding' : 10,
'autoScale' : true,
'cyclic' : true,
'overlayOpacity' : 0.7,
'overlayColor' : '#000000',
'transitionIn' : 'fade',
'transitionOut' : 'fade',
'titlePosition' : 'over',
'titleShow' : false,
'resize' : 'Auto'
});
Has anyone else ever run into this issue?
Thanks in advance for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
弄清楚了...
这是我的 CSS 重置被 FancyBox CSS 绊倒了。我将 DIV 的框大小样式重置为“边框框”。
修复方法是进入 FancyBox CSS 并将包装、外部和内部 DIV 的框大小声明为“content-box”。
就像这样:
希望这能帮助其他遇到这个问题的人。
Figured it out ...
It was my CSS reset that was being tripped-up by the FancyBox CSS. I reset the box-sizing style of DIV's to 'border-box'.
The fix was to go into the FancyBox CSS and declare the wrap, outer, and inner DIV's box-sizing to be 'content-box'.
Like so:
Hopefully that will help somebody else that runs into this.
以上对我不起作用(FB 3beta)。
这是我的解决方案:
Above did not work for me (FB 3beta).
This is my solution:
我遇到了同样的问题,弹出窗口中显示任意 HTML。我发现这就是修复它所需的全部内容(当使用 Eric Meyer 的 reset.css 时)是这样的:
reset.css 文件中的违规代码是这样的
免责声明:仅在 IE9 和 Chrome 中测试 - 但它似乎有效。
这适用于撰写本文时最新版本的 fancybox。
I had the same problem with arbitrary HTML showing in the popup. I found this was all that was necessary to fix it (when using Eric Meyer's reset.css) is this:
The offending code in the reset.css file was this
Disclaimer: Tested only in IE9 and Chrome - but it appears to work.
This is for whatever the latest version of fancybox is at time of writing.
我还发现,摆脱框大小调整的全局重置有所帮助:
烦人的部分是找到所有依赖 border-box 的项目,然后仅为这些项目启用它。对我来说幸运的是,到目前为止我只找到了 3 个。 Firebug/开发者工具对解决这个问题有很大帮助。
I also found that getting rid of the global reset for box-sizing helped :
The annoying part is finding all the items that were relying on border-box and then enabling it for JUST those items. Luckily for me there were only 3... that I've found so far. Firebug / Developer Tools helped a lot to figure it out though.