admin管理员组文章数量:1341873
I'm trying to get my fancyBox to expand in height when its contents are taller than the viewport. That way, the user scrolls its contents using the browser's scroll bar. Instead, my fancyBox keeps getting its own scroll bar.
I'm just using inline content, not an iframe
. These are the options I set:
$('.fancybox').fancybox({
autoSize: 'false',
fitToView: 'false',
maxWidth: 940
});
Adding scrolling: 'no'
cuts off the content at the bottom. Explicitly defining a really tall height works, but I want the height to be determined dynamically.
I'm trying to get my fancyBox to expand in height when its contents are taller than the viewport. That way, the user scrolls its contents using the browser's scroll bar. Instead, my fancyBox keeps getting its own scroll bar.
I'm just using inline content, not an iframe
. These are the options I set:
$('.fancybox').fancybox({
autoSize: 'false',
fitToView: 'false',
maxWidth: 940
});
Adding scrolling: 'no'
cuts off the content at the bottom. Explicitly defining a really tall height works, but I want the height to be determined dynamically.
3 Answers
Reset to default 7Boolean and integer values should go without quotes so this
$('.fancybox').fancybox({
autoSize: 'false',
fitToView: 'false',
maxWidth: 940
});
should be
$('.fancybox').fancybox({
autoSize: false, // shouldn't be true ?
fitToView: false,
maxWidth: 940
});
fitToView
is actually the option that gives you what you need but the quoted "false"
didn't make it work for you. On the other hand, I am not sure you should disable autoSize
because otherwise the inline
content won't get its own height.
Sounds a bit wierd. an ugly solution is to use css, overflow:hidden;
Whenever I use fancybox, the scrollbars work correctly. sure that the content oc the fancybox is not setting another height?
Edit: Viewed your example-site. Seems like there is some width beeing set in the content that is larger than the fancybox itself.
Should anybody look for the solution for an iframe, use:
parent.jQuery.fancybox.update();
本文标签: javascriptHow can I make fancyBox 2 adjust its height to fit its contentsStack Overflow
版权声明:本文标题:javascript - How can I make fancyBox 2 adjust its height to fit its contents? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743647473a2515753.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论