WordPress.org

Ready to get started?Download WordPress

Forums

iframe
[resolved] Suggestion auto height when content in frame changes (6 posts)

  1. muslimbodybuilding
    Member
    Posted 1 year ago #

    I use this script:

    <script language="javascript" type="text/javascript">
     function resizeIframe(obj)
     {
       obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
       obj.style.width = obj.contentWindow.document.body.scrollWidth + 'px';
     }
     </script>

    As you can see the above is a function that resizes based on frame but it doesn't work that well in chrome, sometimes works sometimes doesn't.

    In firefox seems to work right.

    [iframe id="frmid" frameborder="0" padding="0" margin="0" onload="javascript:resizeIframe(this); window.parent.parent.scrollTo(0,0);" src="http://mywebsite.com" scrolling="no"]

    With the above I load the function each time... and it goes back to top otherwise it stays at bottom without the parent.scrollTo(0,0)

    Mind implementing something like this automatically?

    http://wordpress.org/extend/plugins/iframe/

  2. webvitaly
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you very much for your feedback.

    I will test this code and maybe I will add it to next version.

  3. a_ahmed
    Member
    Posted 1 year ago #

    I just thought I'd add, it works in firefox (latest) perfect, works in IE (tested with 9) great, but in chrome it sometimes leaves the page unresized and big spaced... i wish to fix this... the version i use though is the 'dev channels' so maybe its only a glitch in this version.

    Thank you for your efforts though :)

  4. sergiodl
    Member
    Posted 1 year ago #

    Hi,
    I am interested in this script. Could you please telle me exactly what I would need to install it ?
    Thank you for your help.
    Sergio

  5. a_ahmed
    Member
    Posted 1 year ago #

    You have to just put that code where the iframe is or anywhere its run on onload in other words when post or page loads, it looks for that script function "resizeIframe" which is the script. So script just has to be somewhere. I am no longer using an iframe though, I redesigned my forum template to be exact like the site instead. Much smarter honestly. Now it behaves like a normal forum.

  6. sergiodl
    Member
    Posted 1 year ago #

    Thank you for you message. But it is not yet clear for me.
    Do I have to create a file named resizeIframe.js in wp-content/plugins/iframe and put your code there ? it doesn't work like this so I guess it is not the correct way...
    Thanks for you help !
    Sergio

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.