Autosize in version 5.3.2

Page: 1

Author Post
Member
Registered: Jan 2012
Posts: 21
Autosize is not working in new version. At least not for me. I generated a sample for testing:
http://www.miamit.si/floatbox_test/fb_new.html
http://www.miamit.si/floatbox_test/fb_old.html

Am I doing something wrong?
Administrator
Registered: Aug 2008
Posts: 3382
Thanks for the examples.

The source for the iframe page being loaded (fb1.html) isn't really a page at all. It's an HTML snippet. There are no <html> or <body> elements. It is the html and body elements that the latest Floatbox measures to determine content height. Floatbox requires a properly constructed document in the content iframe.

HTML snippets should be brought in as an ajax fetch, and not assigned as the src of an iframe document. Add "type:ajax" to the options to match the content type being requested. It should measure up just fine then.
Member
Registered: Jan 2012
Posts: 21
On my corporate page I have full html pages that I show in FB and auto resizing working with old version.

Even if I put full html tags around sample, FB autosize is not working. I edited original sample from first post.

With type:ajax it's working but I would have to change a bunch of code.
Administrator
Registered: Aug 2008
Posts: 3382
We're getting closer. :-)

Now the problem is that the content in the body is just plain text and not elements. Floatbox is not measuring the body directly because IE returns erroneous results for the body. It will report the available screen height instead of the content height. It is the child elements of the body that are the actual subjects of the measurements. In your content, the only child elements of the body are the <br /> elements, which have no size. You need the paragraphs to be wrapped in <p> and </p> tags to get them included in the sizing.

I agree, although you did not make the point, that the measuring routine could be stronger and should be able to handle this case. I'll work on that. For now, the page needs to be a properly structured page and the content needs to be inside proper HTML elements.


***Update***

I provided some misinformation in this post, and the same mistake was made in the coding of the resize routine. It is not the case that IE returns screen size values for the body element. It does this for the html element. The 5.3.2 code mistakenly excludes the body measurements based on this erroneous 'fact'.

I'll release an update in the not-too-distant future that will correct this body problem. In the meantime, you can either wrap your paragraphs in <p> tags, or don't upgrade until you see the next release.

Thanks for drawing this one to my attention.
« Last edit by admin on Thu May 17, 2012 12:33 pm. »
Member
Registered: Jan 2012
Posts: 21
Indeed we are going in right direction. :)

I again updated sample with surrounded <div> tag and added standard height for FB. This is almost identical code as on my corporate site.

If I remove height from options, measuring is OK. With height FB is not resizing like in old version.

P.S. I'm using Chrome
Administrator
Registered: Aug 2008
Posts: 3382
Correct. In version 5.3 if you specify a particular height, you get that height. In prior versions, if scrolling was set to 'no' then same-domain iframe content would auto-size to the measured content height.

I think the new way makes much more sense. If you request a height, you get it. But it is a change that introduces different behaviour based on the old markup. Under this version, you need to remove the height setting to trigger measurement (or set measureHTML:yes in the options).

It's not often that Floatbox changes things in a way that may require markup adjustments, but sometimes it's necessary. It's been particularly difficult trying to keep everyone happy with auto-sizing behaviour given the variety of content and expectations of different users.
Member
Registered: Jan 2012
Posts: 21
OK.

I accept you explanation. I understand that old behavior is hard to maintain along new versions. I will check my code and make minimal changes for FB autosize.

Thanks.

Page: 1