dynamically resizing page body after iframe reduction

4 replies
  • WEB DESIGN
  • |
I have a page that uses an iframe to display real time information. The iframe resizes according to content. However, although the page grows to accommodate the iframe content, the body does not shrink back when the iframe is reduced in size. Instead, the page will display a blank space below the frame. How can I shrink the size of the body back to it's original size, that is to say, assure that the space below the iframe is also resized accordingly. At present, it grows as needed but does not shrink if the content in the iframe becomes shorter. How do I ascertain the current length of the page and reset the body size?
#body #dynamically #iframe #page #reduction #resizing
  • Profile picture of the author jquery85
    Now i am using this code. I think you need it for your project.
    Code:
        <script type="text/javascript">
    		$(document).ready(function() {
    			var w = $(".window").width() + 40;
    			var h = $(".window").height() + 80;	
    			 window.resizeTo(w,h);			 
    		});
                     
    	</script>
    {{ DiscussionBoard.errors[10058893].message }}
  • Profile picture of the author Steviebone
    Thank you, I dont want to resize the browser window just the body height so that there is no excess scrolling at the bottom of the page showing nothing but empty space after a reduction in the iframe content block.
    {{ DiscussionBoard.errors[10064436].message }}
  • Profile picture of the author Steviebone
    The problem turned out to be an issue with the iframe height itself not the page body. Using body.offsetHeight with a small pad instead of a max() calc fixed the problem. Not fully tested but appears to be working. This question is no longer relevant.

    Thank you.
    {{ DiscussionBoard.errors[10064507].message }}

Trending Topics