npr / responsiveiframe

Responsive IFrames

Home Page:http://npr.github.com/responsiveiframe/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not update the height when content changes in the iframe

alesas opened this issue · comments

Hi,

It seems to work great (good job!) on load and on window resize but I have some dynamic content and it doesn't update the height of the iframe.

Demo here:
http://www.auto365.fr/test/test.php

Is there a way to trigger the function manually when user clicks on some element (here "Etape 2")?
Thx!

Quickfix for changes that are toggled via click - in jquery.responsiveiframe.js replace/add
(adjust the timeout to your needs!)

ResponsiveIframe.prototype.allowResponsiveEmbedding = function() {
    if (window.addEventListener) {
      window.addEventListener("load", self.messageParent, false);
      window.addEventListener("resize", self.messageParent, false);
      window.addEventListener("click", function () {

        setTimeout( function () {
          self.messageParent();
        }, 500);

      }, false);
    } else if (window.attachEvent) {
      window.attachEvent("onload", self.messageParent);
      window.attachEvent("onresize", self.messageParent);
      window.attachEvent("onclick", function () {

        setTimeout( function () {
          self.messageParent();
        }, 500);

      });
    }
  };