Skip to content

Height not resizing correctly when iframe content has proportional sized div #163

Closed
@regauser

Description

@regauser

Hi

The content on my iframe needs to be always at a 16:9 ratio of width:height.

Unfortunately, when I use proportional content like this, my iframe height is not getting resized correctly by iframeresizer.

I have setup two demos using different methods to create the proportional div:
http://www.wavyd.com/tests/iframeresize-proportional/v1-consumer.htm
http://www.wavyd.com/tests/iframeresize-proportional/v2-consumer.htm

Both demos have a 16:9 ratio box (red), one line of text content under it, and a 1px black border applied to the bottom of the 'body' so it is clear where the iframe should end.

With both of demos, when the page loads, press one of the buttons to call 'iFrameResize' using a particular 'heightCalculationMethod'.

At this first resize, in Chrome the iframe is resized correctly.

In IE11, however, it will only do this first resize correctly if the resize doesn't result in the consumer page needing a vertical scrollbar.

Next, with either browser, when you resize the window, you can see the iframe resizing, but usually when you let go of the mouse, it has not applied the correct height. You will see that the black border is either hidden as the iframe is too small, or has white space under it as the iframe is too big.

Oddly, on either browser, if you then 'click' anywhere on the iframe, this event always resizes the iframe correctly.

The first of the two demos uses an absolute positioned child. So, as recommended in your absolute position example, I have tried each of the different 'heightCalculationMethod', but with no success.

The second demo doesn't use absolute positioning, but still has problems with setting the height correctly. Again I have tried each of the different 'heightCalculationMethod' values.

I hope you can help.

David

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions