스크립트

모바일 리사이즈 아이프레임 스크롤컨트롤

김청 2016. 6. 22. 12:23
<★SCRIPT LANGUAGE="JavaScript"> 
function resizeIframe(fr) { 
fr.setExpression('height',ifrm.document.body.scrollHeight); 
fr.setExpression('width',ifrm.document.body.scrollWidth); 
} 
 

<★div style="padding:10px; overflow:scroll; overflow-x:hidden; -webkit-overflow-scrolling: touch; height:200px; margin-bottom:-1px; border:1px solid #d9d9d9; ">
	<★iframe id="test_agree" src="iframe_agree.html" scrolling="yes" style="overflow:hidden; display:inline-block; width:100%; height:100%; border:0; background:transparent;" onload="resizeIframe(this)">

<★iframe width="100%" src="iframe_agree.html" scrolling="no" id="the_iframe" onLoad="calcHeight();" height="1px" frameborder="0" >

<★script type="text/javascript">
   function calcHeight()
   {
    //find the height of the internal page
    var the_height=
    document.getElementById('the_iframe').contentWindow.
    document.body.scrollHeight;

    //change the height of the iframe
    document.getElementById('the_iframe').height=
    the_height;
   }
<★/script>