Comments (4)
The problem with using absolute positioning is that it takes the content outside of the body tag, and it is this that we use to get the height. Have you tried the suggestions in the troubleshooting section, it contains a few suggestions on how to work around this problem.
The other issue is CSS changes are not going to be picked up by the DOM mutationObserver code, as the DOM doesn't change. This is something I had not considered and I'll as a click event listener to the window object to work around that, although that won't help if it's a hover event that causes the content to resize. The ultimate fallback is to set the interval
option to -32 to force it to run instead of the mutationObserver.
So in summary try running with these options.
iFrameResize({
log: true,
heightCalculationMethod:'scroll',
interval:-32
}
and also add this just before </body>
in your iFrame HTML.
<div style="clear:both;"></div>
If it still doesn't work, post a live example online and I'll take a quick look.
from iframe-resizer.
Adding the click event listener did the trick, it worked instantly. Your code has solved a set of problems I had expected to spend weeks working on. Thanks.
Two unimportant questions:
(1) Since I am not yet testing for ie8 (want to setup a VM with XP) I would like to know if I can just take that block of code that begins [if (!Array.prototype.forEach){] and throw it in near the top of a referenced *.js file and expect it to work as is, or would it need additional packaging?
A question of pure curiosity if you feel inclined to reply:
(2) I'm old (63) and have never really understood listener/callback coding (which may or may not be relevant to this question) but I had expected to have problems using two realizable iframes called from the same parent page, but the code appears to work flawlessly. How does the parent code [iframeResizer.min.js] know which child [iframeResizer.contentWindow.min.js] is calling back with it's size info? I presume two instances of the contentWindow code are being created? (Perhaps you could add a quick note in your documentation mentioning that multiple iframes are automatically handled.)
Thanks hugely. I will be sure to leave links back to your page in my js files.
from iframe-resizer.
So I'm guessing you tried version 2.2.2 then.
To answer your questions.
- Yep, it can go there, or anywhere before you make the call to
iframeResizer()
. - There's only one instance of the code running and messages are all received on the window listener. If you look at the console log you can see the messages that are past between the two pages. The trick is that the first message is sent from the host page and this contains the ID of the iFrame, when the iFrame replies is includes this ID, so the host page know's where the request came from. The message also starts with an identifier for the script, so it knows to ignore messages from any other code on the page.
Hope that explains it.
from iframe-resizer.
"So I'm guessing you tried version 2.2.2 then."
Yup.
from iframe-resizer.
Related Issues (20)
- Example page not working HOT 3
- Library removes height:auto inline style from html and body elements HOT 1
- Iframe Didn't work properly when added a class to hide some text. HOT 1
- How can I use "autoResize" option dynamically. It's not working as expected. HOT 3
- How can I write a test to test what happens when iframeresizer onMessage is invoked? HOT 1
- How to use this in SvelteKit? HOT 2
- wrong files version in js folder for 4.3.6
- Undocumented option `warningTimeout`
- Logo Design
- Feature request: add optional offset argument to moveToAnchor method HOT 4
- Trigger iframe-resizer to resize HOT 1
- How to integrate with nuxt3? HOT 2
- Time overhead when adding many elements under a same HTML element HOT 4
- i am having button inside iframe . how can i detect button click event HOT 1
- Scroll to element on AJAX request not working in child page even with scrolling set to yes HOT 1
- BREAKING🐞: `v4.3.9` release breaks usage of `.min.js` file from CDN HOT 5
- Scrolling may make the page jump to the left HOT 4
- [Feature Request] Add onResizeError callback HOT 4
- Value for minHeight can not be greater than maxHeight HOT 1
- Extra padding in Safari (macOS) 17.3 HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iframe-resizer.