5.7.2 doesn't resize correctly anymore

Page: 1

Author Post
Member
Registered: Aug 2012
Posts: 26
Hello,

version 5.7.2 doesn't resize to HTML content anymore if a link inside the document is followed. To reproduce go to http://www.leihinstrumente.com/ click on "payment options", then click on "CREDIT CARD", then click "back" in the lower left corner.

FB doesn't restore the size of the previously used page but stays the same size as on the CREDIT CARD page. This used to work in version 5.3.4. Tested on FF, IE, Safari and Chrome.

regards
Erik
Administrator
Registered: Aug 2008
Posts: 3382
Hi Erik,

Unfortunately, I can't debug this one for you. All the relevant navigation on that page is done by custom script, including the initial launching of the floatbox and the subsequent content changes inside the iframe. If I pull this over to my test site the structure becomes cross-domain and the custom scripts are not executable in that context.

It looks like you're going to have to take control of the resizing yourself. This is probably best done by adding a window.load event handler to the content pages that are presented in the floatbox. Something like...

parent.fb.addEvent(window, 'load', parent.fb.resize);
Member
Registered: Aug 2012
Posts: 26
This worked (after I inserted () behind resize), but only if called via window.setTimeout of 100 ms.

The strange thing is, it works without the resize line for the first link (FB gets smaller) but not for any subsequent ones.

All content changes inside the iframe (except the back link) are done by normal links. You can use the [more] link on the CREDIT CARD page to avoid the back link. FB stays small, too.

I tried to disable all options I set in the fb.start function and on document loading to no avail.

Since I guess this is supposed to work, could you point me to a page where this actually works?

I'd hate to revert to version 5.3.4...

regards
Erik
Administrator
Registered: Aug 2008
Posts: 3382
Let's not mislead other folks reading this. Using the addEvent syntax I provided does not need () on the resize call to invoke the function. The third argument to addEvent is a function, and that's what fb.resize is. If you call fb.resize() from that parameter location then it is firing at the time of the addEvent call, not at window load time, and no event handler gets assigned. This is perhaps why you needed to put a timeout on it.

Nope, I don't have a page with multiple links in iframe content to test this, but it is now on my do-list to build such a test case. If the inability to auto-resize shows up there I'll certainly have the problem resolved in the upcoming version 6.0 release.

You say the manual call to resize is working for you, so it's really up to you whether you want to leave that in place or run the old version. I understand you get the desired behaviour under both setups.

Cheers...
Member
Registered: Aug 2012
Posts: 26
If I use it without the (), the floatbox is mispositioned such that only the very right edge and the close button is visible at the left edge of the browser window. In firebug I can see that the div ID=fbox has a width of 0. If I increase the width (another div and the iframe are 0 width, too) in firebug such that I can see the content and click a link the height changes even for subsequent links. So it would work if the width and position would be correct.

What I did is place

<script>
if (parent.fb)
parent.fb.addEvent(window, &#039;load&#039;, parent.fb.resize);
</script>
in the <head> section.

regards
Erik
Administrator
Registered: Aug 2008
Posts: 3382
Sounds like you need to specify a width in the resize call, or enforce content width somewhere in the content html and css. Please see the API reference for details about the resize function. A call with a width parameter might look something like...
<script>
if ( parent.fb )
parent.fb.addEvent( window, &#039;load&#039;, function () {
parent.fb.resize( 600 );
} );
</script>


...or...
retain the existing box width with parent.fb.resize( -1 );
« Last edit by admin on Mon Jun 03, 2013 6:48 pm. »
Member
Registered: Aug 2012
Posts: 26
I use
  parent.fb.addEvent( window, &#039;load&#039;, function () {
parent.fb.resize();
} );
and it works like a charm. Many thanks!

regards
Erik
Member
Registered: Aug 2012
Posts: 26
Unfortunately the call of fb.resize() kills the scroll to id functionality as mentioned in the other thread. Any chance this will be fixed in the next version?

Page: 1