How can I make fancyBox 2 adjust its height to fit its contents?

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.

Answers:

Answer

Boolean 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.

Answer

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.

Answer

Should anybody look for the solution for an iframe, use:

parent.jQuery.fancybox.update();

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.