0

I'm trying to create a responsive iframe, actually I need to create a .html that will be put in an iframe on which I can only change de Width and Height... Also if I set the height and width of this iframe to 100% I see that the iframe just cut everything is going over 200px of height...

So actually I try to make a responsive background with an image of 1920x2428px

I've it:

<html>
    <head>
    </head>
    <body>
        <div class="container" id="container" style='background: transparent url("http://slpubmedias.tf1.fr/test_nocache/test_jf/BlindSpot/Desktop/bg.jpg") no-repeat scroll 0% 0% / 100% auto; max-width:100%;width: 100%; height:100%;   position: absolute;'></div>
    </body>
</html>

The problem I meet is that, I set my iframe to 100% width and 2428px height, and my background to 100% 100%, but when I reduce the size of the window a white area which is the px that my background don't use anymore stay under my background, I'd like to do a:

var div = document.getElementById("container");

setInterval(function() {
    divHeight = div.offsetHeight;
    parent.document.getElementsByClassName('custom_device_iframe')[0].style.height=divHeight;       
}, 100);

The problem is that is returns the height of the div and I'd like to get the height of the background only.

deltree
  • 3,756
  • 1
  • 30
  • 51
  • 1
    Possible duplicate of [Get the Size of a CSS Background Image Using JavaScript?](http://stackoverflow.com/questions/3098404/get-the-size-of-a-css-background-image-using-javascript) – t.niese Aug 04 '16 at 13:08
  • That's not exactly the same i'd like to get the height of the actual Background and put this command into a setInterval() and update the height of the parent iframe with this height ... –  Aug 04 '16 at 13:43
  • Then you should take a look at this [Get final size of background image](http://stackoverflow.com/questions/29999515/get-final-size-of-background-image) – t.niese Aug 04 '16 at 16:04

0 Answers0