Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript JavaScript, different iFrame-Content and WP

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #150665
    sonicate
    Participant

    Hello everybody,

    hope someone can help.

    I added in the header of a WP-theme an iFrame. On screens above 1024px one content is loaded, under 1024px another, more flexible, with dynamically iFrame size.
    The script that I have added running locally well, tested with the iPhone simulator and in different browsers. Online, however, it is not running. Where is the mistake?
    Here is the code:

    in the header ->

    <script type="text/javascript">
    if(screen.availWidth>1024){
    throw "stop execution";
    }
    else {
    var framefbox = document.getElementsByTagName("iframe");
    var auto_resize_timer = window.setInterval("autoresize_frames()", 400);
    function autoresize_frames() {
    for (var i = 0; i < framebox.length; ++i) {
    if(framebox[i].contentWindow.document.body){
    var framebox_size = framebox[i].contentWindow.document.body.offsetHeight;
    if(document.all && !window.opera) {
    framebox_size = framefbox[i].contentWindow.document.body.scrollHeight;
    }
    framebox[i].style.height = framebox_size + 'px';
    }
    }
    }
    }
    </script>
    <script>
    if(screen.availWidth<1024){
    document.getElementById('plan').location.href = 'content_flex.html';
    }
    </script>

    in the body ->

    <div align="center" width="100%" id="carte" style="margin-top:0;"><iframe id="plan" src="content.html" height="723" width="1164" frameborder="0" scrolling="no"></iframe></div>

    Thanks for help

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.