FancyBox调整宽度 [英] FancyBox resize width
问题描述
我可以使用 $。fancybox.resize();
部分调整高度,但宽度不会根据新内容进行更新。想法?
I'm able to resize the height with the $.fancybox.resize();
part, but the width just doesn't update according to the new content. Thoughts?
推荐答案
来自 fancybox api docs :
$。fancybox.resize
:自动调整FancyBox的大小高度以匹配内容的高度。
$.fancybox.resize
: "Auto-resizes FancyBox height to match height of content."
所以看起来它并不打算调整宽度。
So it looks like it is not intended to adjust the width.
如果您想调整宽度,可以手动调整#fancybox-wrap
和#fancybox-inner
元素。经过一些非常快速的检查,它看起来像 #fancybox-wrap
被设置为比 #fancybox-inner
宽20px:
If you wish to adjust the width, you can do it by manually resizing the #fancybox-wrap
and #fancybox-inner
elements. After some very quick checking, it looks like #fancybox-wrap
is set to 20px wider than #fancybox-inner
:
$('#fancybox-inner').width(400);
$('#fancybox-wrap').width(420);
您还可以使用 width <首次注册fancybox时控制宽度/ code>选项:
You can also control the width when you first register fancybox using the width
option:
$('#somelink').fancybox({ width: '100px' });
这篇关于FancyBox调整宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!