0
Welcome Guest! Login
0 items Join Now

SOLVED Best iFrame resize script?

    • wolfy's Avatar
    • wolfy
    • Jr. Rocketeer
    • Posts: 24
    • Thanks: 0

    SOLVED Best iFrame resize script?

    Posted 12 years 10 months ago
    • Hey,

      does anyone know a good iFrame resize - script? I was using SSI script II until today - it worked nicely - when I updated FF to it's latest version, it stopped functioning :cry:

      I love ECWID, but I require more functions and have to use Presta Shop instead ... so I created something similar to ECWID, loading it into an iFrame, and it worked fine - until today.

      --> The solution from minitek ( for the Wrapper ) doesn't work for me ( us ), since there is no such file in such directory in our templates ( I use Ionosphere ).

      --> MooTools have something built-in, it seems: https://gist.github.com/1502971 , but I'd need some advice to get it to work.

      :arrow: maybe LightFace, also from Mootools, would be an option: http://davidwalsh.name/dw-content/lightface.php

      Your opinion wanted!
    • Last Edit: 12 years 9 months ago by wolfy.
    • wolfy's Avatar
    • wolfy
    • Jr. Rocketeer
    • Posts: 24
    • Thanks: 0

    Re: SOLVED Best iFrame resize script?

    Posted 12 years 10 months ago
    • I give the "iframe resize with Mootools"-script a try:
      and inserted this in the head of my page:
      <script type="text/javascript">
      window.addEvent('domready', function(){
          function resizeIframe( iframe ){
              var innerDoc = $( ( iframe.contentWindow ) ? iframe.contentWindow.document.body : iframe.contentDocument.body ) );
              var objToResize = (iframe.style) ? iframe.style : iframe;
              var sizes = innerDoc.getSize();
              var offsetHeight = sizes.scrollSize.y + 50;
              objToResize.height = offsetHeight + '2px';
          }
          if( $('iframe') != null ){
              var iframe = $('iframe');
              iframe.addEvent('load', function(){
                  resizeIframe( this );
              });
              if( window.webkit || window.opera ){
                  var source = iframe.src;
                  iframe.src = 'com/shop';
                  iframe.src = source;
              }else{
                  resizeIframe( iframe );
              }
          }
      });
      </script>

      and this:
      <iframe id="iframe" name="iframe" src="com/shop" style="margin-left: 22px; margin-top: 20px" width="870" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%;"></iframe>

      in the body ( = the iFrame in the article where I call the shop ). I named the iFrame "iFrame" to make absolutely sure I don't mess it up.

      Effect = 0. ( no resize, the shop displays, yes ). I'd like to get it to work!
    • wolfy's Avatar
    • wolfy
    • Jr. Rocketeer
    • Posts: 24
    • Thanks: 0

    Re: SOLVED Best iFrame resize script?

    Posted 12 years 9 months ago
    • I partly solved this issue:

      SSI script II works fine - cross browser - it's just that Firefox changed something in it's linking behaviour ...

      For some reason I could call the site with the iFrame without typing "www" into the address bar,
      and now it's a *must* - otherwise the shop will not resize the iframe.

      The other things did not work for me.
      Good luck if you're attempting to do this yourself :-)

      Much easier to stick with ECWID or Magento :-)

Time to create page: 0.074 seconds