Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Width does not shrink when heightCalculationMethod is 'bodyOffset' #70

Closed
WebVeteran opened this issue Jul 7, 2014 · 6 comments
Closed
Assignees

Comments

@WebVeteran
Copy link

The only way I was able to get the frame width to shrink reliably was to set heightCalculationMethod: 'max'. That causes a bad flicker when the iframe disappears and the container's footer jumps up. To get around that I set the iframe's CSS min-height to 500px;
I suggest defaulting heightCalculationMethod to 'max'. And on init set the min-height css of the iframe to 500px. Make that a setting of course.
Also 'heightCalculationMethod' should probably be renamed as 'sizeCalculationMethod' as it also effects the width.

@davidjbradshaw
Copy link
Owner

The point about the calculation method effecting the width is an interesting one that I will have to think about for a future version. I expect creating a forceResize flag rather than having it dependent on the height calc method is the way forward.

As for changing the minHeight, which is an option you can pass in the code and the default height calc method I think the current defaults are best for most users.

Thanks,
Dave.
PS good to hear someone is using this to do width resizing, it was added as a bit of a whim to this lib.

@jakehilton
Copy link

I can only get the width to adjust adjust wider but it does not shrink. I'm using the heightCalculationMethod set to max. If it does affect the width as well then the rename might make sense as mentioned above.

@jakehilton
Copy link

In looking at the code.. the width is calculated off of a fixed type.. so we cannot change it. It uses
Math.max(document.documentElement.scrollWidth, document.body.scrollWidth); .. I'm going to run a few use cases to see if I get better results using a different option.

@WebVeteran
Copy link
Author

Jake - something else might be going on. In my case the width does shrink when appropriate.

@MartijnKooij
Copy link

+1
We are seeing a similar "flicker" when setting the calculation method to 'max'. Not sure if it is the exact same issue though.
When clicking form fields inside the resized frame, the frame will grow a bit and then shrink again. In IE it's a bit different as it no longer shrinks after growing?

davidjbradshaw added a commit that referenced this issue Jun 19, 2015
@davidjbradshaw
Copy link
Owner

Fixed in v3.0.0. Beta version currently in the dev branch.

https://github.com/davidjbradshaw/iframe-resizer/tree/dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants