fancyapps/fancyBox — Issue #175: Automatic height iframe possibilities with FancyBox 2.0
Author: Martijn1981
Created: 2012-03-06 15:34:50+00:00
State: open

Hi,

quick question. I'm currently using Fancybox 1.3.4 for a project, but it's kinda limited. Want to use 2.0, but I'm using a custom script in the onComplete function, which calculates the height of the content, adds 20px and then resizes the iframe accordingly.

$("a.iframe").each(function () {

$(this).fancybox({
'padding': 0,
'margin': 0,
'modal': true,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'centerOnScroll': true,
'scrolling': 'no',
'onComplete': function () {
$('#fancybox-frame').load(function () {
$('#fancybox-content').height($(this).contents().find('body').height() + 20);
var heightPane = $(this).contents().find('#content').height();
$(this).contents().find('#pane2').css({
'height': heightPane + 'px',
'overflow': 'auto'
})
});
},
'onClosed': function () { doPostbackAsync('modalboxevent', 'modalevent'); }
});
});

So, how should I modify this function, so that it works with Fancybox 2.0?

* Which callback should I use instead of onComplete in 2.0? afterLoad?
* Should I use $.fancybox.update() in the callback?

I know this isn't exactly the place for these kind of things, but you would help me out a lot! Thanks in advance!