[英]FancyBox resize width
I'm able to resize the height with the $.fancybox.resize();
我可以用
$.fancybox.resize();
调整高度$.fancybox.resize();
part, but the width just doesn't update according to the new content. 部分,但宽度不会根据新内容更新。 Thoughts?
思考?
From the fancybox api docs : 来自fancybox api文档 :
$.fancybox.resize
: "Auto-resizes FancyBox height to match height of content." $.fancybox.resize
:“自动调整FancyBox 高度以匹配内容的高度。”
So it looks like it is not intended to adjust the width. 因此看起来它并不打算调整宽度。
If you wish to adjust the width, you can do it by manually resizing the #fancybox-wrap
and #fancybox-inner
elements. 如果要调整宽度,可以通过手动调整
#fancybox-wrap
和#fancybox-inner
元素的大小来实现。 After some very quick checking, it looks like #fancybox-wrap
is set to 20px wider than #fancybox-inner
: 经过一些非常快速的检查后,看起来
#fancybox-wrap
设置为比#fancybox-inner
宽20px:
$('#fancybox-inner').width(400);
$('#fancybox-wrap').width(420);
You can also control the width when you first register fancybox using the width
option: 使用
width
选项首次注册fancybox时,您还可以控制width
:
$('#somelink').fancybox({ width: '100px' });
In newer versions of fancybox (1.3.4 in my case) use 在较新版本的fancybox(在我的情况下为1.3.4)使用
$('#fancybox-content').width(600);
instead of 代替
$('#fancybox-inner').width(400);
for manually adjusting the width 用于手动调整宽度
make some changes in jquery.fancybox.js near about line nubmer:837 change 在约有线nubmer:837更改附近的jquery.fancybox.js中进行一些更改
current.width = loadingBay.width();
to 至
current.width = loadingBay.width() + 2*current.padding;
it worked fine to me. 它对我很好。
Here's what worked for me: 这对我有用:
$('#fancybox-wrap, #fancybox-outer, #fancybox-content').css('width', 'auto');
$.fancybox.center();
Just open jquery.fancybox.js and add your own width. 只需打开jquery.fancybox.js并添加自己的宽度。 Here is my code with width = 72%.
这是我的代码,宽度= 72%。
// Reset dimensions so we could re-check actual size
wrap.add(skin).add(inner).width('72%').height('auto').removeClass('fancybox-tmp');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.