0

How can I make the below frame, once loaded, to allow for the user to drag and scale the size? Is this possible with HTML/CSS/JS?

<script>
    var frame;
    function addFrame() {
       frame = document.createElement('iframe');
       frame.height = "200px";
       frame.width = "200px";
       frame.setAttribute('id', 'superFrame');
       document.body.appendChild(frame);
    }
    function loadGoogle() {
       frame.setAttribute('src','http://www.google.com')
    }
</script>

Left is what I have, right is what I want but with the user setting the size via dragging the frame.

Image

freginold
  • 3,946
  • 3
  • 13
  • 28
Luke Toss
  • 356
  • 5
  • 23

1 Answers1

0

src Responsive IFrames — The Right Way!

  1. remove width and height attributes
  2. set up a parent div for the iframe
  3. make the containing div responsive, and the iframe with the following size/positioning rules:

    iframe { position: absolute; top:0; left: 0; width: 100%; height: 100%; }

roberto tomás
  • 4,435
  • 5
  • 42
  • 71