Giter Club home page Giter Club logo

Comments (4)

davidjbradshaw avatar davidjbradshaw commented on July 19, 2024

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.

FriarBroccoli avatar FriarBroccoli commented on July 19, 2024

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.

davidjbradshaw avatar davidjbradshaw commented on July 19, 2024

So I'm guessing you tried version 2.2.2 then.

To answer your questions.

  1. Yep, it can go there, or anywhere before you make the call to iframeResizer().
  2. 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.

FriarBroccoli avatar FriarBroccoli commented on July 19, 2024

"So I'm guessing you tried version 2.2.2 then."

Yup.

from iframe-resizer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.