fancybox宽度不适用 [英] fancybox width doesn't apply
问题描述
我正在尝试为fancybox设置宽度
I'm trying to set up a width for the fancybox
$("a.loader").fancybox({
width: 1000,
height: 1050,
autoDimensions: false,
maxWidth : '100%'
});
阅读一些主题,但是设置autoDimensions: false,
,尝试设置带有px和不带有px,带有逗号和不带有px的宽度.没什么帮助,fancybox出现的宽度和高度都相同.
Read some topics, but set up autoDimensions: false,
, tried to set width with px and without it, with commas and without it. Nothing help, the fancybox appears with the same widht and height.
出了什么问题?
P.S.如果是这种情况,请jquery-1.8.2.min.js
和jquery.fancybox.pack.js
(在2至3周前下载).
P.S. jquery-1.8.2.min.js
and jquery.fancybox.pack.js
(downloaded 2 to 3 weeks ago) if that's the case.
已添加:此外,没有其他CSS或jquery代码在花式框上应用额外的宽度.
Just added: Also, there are NO additional width that could apply on the fancy box from other css or jquery code.
推荐答案
如果您使用的是 fancybox v2.x 则API选项是新的,并且与以前的版本 1.3.x
If you are using fancybox v2.x then the API options are new and not compatible with previous version 1.3.x
因此对于fancybox v2.x,不存在autoDimensions
选项,但应改用autoSize
.另一方面,如果您的视口(屏幕尺寸)小于您想要的fancybox中的尺寸,则内容将被缩放以适合视口.如果要强制大小,则必须设置fitToView: false
.
So for fancybox v2.x the autoDimensions
option doesn't exist but autoSize
should be used instead. On the other hand if your view port (screen size) is smaller than the size you want in fancybox, the content will be scaled to fit into the view port. If you want to force the size, then you have to set fitToView: false
.
注意:这仅对ajax
,html
,inline
和iframe
内容有效.图像将始终按比例缩放以适合视口或以其原始大小打开...您无法通过width
或height
API选项来操纵图像的大小.
NOTE : This is only valid for ajax
, html
, inline
and iframe
content. Images will always open either scaled to fit in the view port or in their original size ... you can't manipulate the size of images via width
or height
API options.
因此您的 v2.x 脚本应为
$("a.loader").fancybox({
width: 1000,
height: 1050,
autoSize : false,
fitToView : false,
maxWidth : '100%' // I don't think you need this
});
...仅对ajax,html,inline和iframe内容有效,而对图像无效.
... valid for ajax, html, inline and iframe content only, not images.
这篇关于fancybox宽度不适用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!