fb.resize()

Page: 1

Author Post
Member
Registered: Jan 2012
Posts: 98
I am using fb.resize very satisfactorily in one place, like this:

parent.fb.resize( {left: -360, width: true, height:true }, function () {
<?php if ($_SESSION['origin_id']) { ?>
parent.window.history.pushState(null, null, "beta_tree.php");
parent.location.reload( true );
<?php }else{?>
parent.location.replace( "map.php" );
<?php }?>
}, 1.0 );

Done this way, the floatbox window moves out of the left side of the browser and the parent page is refreshed.

However when I change the script to this,

parent.fb.resize( {width: 0, height:0 }, function () {
<?php if ($_SESSION['origin_id']) { ?>
parent.window.history.pushState(null, null, "beta_tree.php");
parent.location.reload( true );
<?php }else{?>
parent.location.replace( "map.php" );
<?php }?>
}, 1.0 );

it doesn't work as expected. I expected it to close down the window by shrinking it to zero. Instead the height shrinks down until there is only the "Close" link left and the width is unchanged. If I then ckick"Close", the floatbox shrinks and disappears.

I've also tried 0% instead of 0. What am I doing wrong?
Administrator
Registered: Aug 2008
Posts: 3381
Width and height requests passed to fb.resize apply to the content area of the floatbox and do not include the surrounding frame area which contains various controls and captions.

A width request for 0px may be overridden with a default or set minWidth option (called minContentWidth in pre-7 Floatbox versions). There may be some other reason why your content width is not going to zero. We could pursue the reason if you wish, but this may be a waste of time because the fb.resize function is never going to shrink the frame area down to nothing.

Would it perhaps be more appropriate to just end the floatbox? Let it animate down to zero and then do the page manipulation after the floatbox has vanished.
fb.end( function () {
...
} );
Member
Registered: Jan 2012
Posts: 98
Yes, there was a minWidth in the fbOptions but I'm sure I tried removing that line without any effect.

I've now got it working with a simple
parent.fb.end('filename');


Thanks, Byron.

Page: 1