如何让fancyBox 2调整其高度以适应其内容? [英] How can I make fancyBox 2 adjust its height to fit its contents?

查看:109
本文介绍了如何让fancyBox 2调整其高度以适应其内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的 fancyBox 在其内容高于视口时展开高度。这样,用户使用浏览器的滚动条滚动其内容。相反,我的fancyBox不断获得自己的滚动条。

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.

我只是使用内联内容,而不是 iframe 。这些是我设置的选项:

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.

推荐答案

布尔和整数值应该没有引号所以这个

Boolean and integer values should go without quotes so this

$('.fancybox').fancybox({
    autoSize: 'false',
    fitToView: 'false',
    maxWidth: 940
});

应该是

$('.fancybox').fancybox({
    autoSize: false, // shouldn't be true ?
    fitToView: false,
    maxWidth: 940
});

fitToView 实际上是给你的选项你需要什么,但引用的false并没有让它适合你。另一方面,我不确定你应该禁用 autoSize ,否则内联内容将无法自行获取身高。

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.

这篇关于如何让fancyBox 2调整其高度以适应其内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆