Embedding a PDF/Resizing an iFrame to use 100% of available width and height
Submitted by Hermit Barber on Wed, 2011-06-22 20:05
Recreated to resize the window to something useable - which took more javascript than it should :-(
Example follows representation of script. Place it on a Drupal page:
<script language="JavaScript"> <!-- function resize_iframe() { var height=window.innerWidth;//Firefox if (document.body.clientHeight) { height=document.body.clientHeight;//IE } //resize the iframe according to the size of the window (all these should be on the same line) document.getElementById("glu").style.height=parseInt(height-document.getElementById("glu").offsetTop-8)+"px"; } // this will resize the iframe every time you change the size of the window. window.onresize=resize_iframe; //Instead of using this you can use: // <BODY onresize="resize_iframe()"> //--><!-- function resize_iframe() { var height=window.innerWidth;//Firefox if (document.body.clientHeight) { height=document.body.clientHeight;//IE } //resize the iframe according to the size of the window (all these should be on the same line) document.getElementById("glu").style.height=parseInt(height-document.getElementById("glu").offsetTop-8)+"px"; } // this will resize the iframe every time you change the size of the window. window.onresize=resize_iframe; //Instead of using this you can use: // <BODY onresize="resize_iframe()"> //--> </script><p>Recreated to resize the window to something useable - which took more javascript than it should :-(<br /> <iframe id="glu" width="100%" onload="resize_iframe()" src="http://emilie.hermit.net/sites/emilie.hermit.net/files/FN_press_eng_10042011.pdf"><br /> </iframe> </p>
Recreated to resize the window to something useable - which took more javascript than it should :-(
»
- Printer-friendly version
- Login or register to post comments
