반응형

JS 파일

 

<script Language='javascript'>

var ifrmHeight;

var objFrame;

var str;

var cstr;

function init() {

                try{

                        

objFrame = document.all["ifrm"];

                        str = window.clipboardData.getData("Text");

                        cstr = str.split("|");

                        ifrmHeight= eval(cstr[1]); 


        }catch(e){

                }

}

function reSize() 

{

                try{ 

                        if 

(ifrmHeight > 240) {

                                        

objFrame.style.height = ifrmHeight;

                        

}else{

                                        objFrame.style.height = 240;

                        } 

        

}catch(e){

                }

}


function init_iframe() { 


        reSize(); 

        

setTimeout("init_iframe()",100);

}

init_iframe();

</script>

 

 

 

삽입

 

<iframe src="게시판 주소" name="ifrm" width="100%" height="100%" marginwidth="0" marginheight="0" frameborder="no" onload="init()" scrolling="no"></iframe>

 

 

 

 

제로보드 버전에 따라 다르지만 모듈-게시판-게시판정보-게시판관리에 하단내용에 반드시 넣어야한다.

 

 

 

<script language="javascript">

window.clipboardData.setData('Text', document.body.scrollWidth+"|"+document.body.scrollHeight);

</script>

반응형

'프로그래밍 > Javascript' 카테고리의 다른 글

iframe resize jquery 아이 프레임 리사이징 소스  (0) 2016.02.02
셀렉트 박스 링크 걸기  (0) 2016.01.30
eval()  (0) 2015.11.21
for 문 -- 별 삼각형 출력하기  (0) 2015.10.14
switch 문  (0) 2015.10.11
반응형

요즘 반응형이 아이프레임을 리사이징 하는것에 대해서는 어떻게 해야 난감할때가 있습니다.

 

일반 리사이징하면 가로*세로 비율이 유지되면서 리사이징이되는것을 생각하지만 기준이 가로폭이 됩니다.

 

하단에 스크립트 넣어주시고, 혹은 *.js로 저장하시고,

 

<script type="text/javascript">
function resize_frame(id) {
var frm = document.getElementById("embeded-content");
function resize() {
frm.style.height = "auto"; // set default height for Opera
contentHeight = frm.contentWindow.document.documentElement.scrollHeight;
frm.style.height = contentHeight + 300 + "px"; // 23px for IE7
}
if (frm.addEventListener) {
frm.addEventListener('load', resize, false);
} else {
frm.attachEvent('onload', resize);
}
}
resize_frame('embeded-content');
</script>

 

해당 아이프레임에 아이디값 embeded-content을 줍니다. 높이를 제시해야.. 아이프레임 영역이 생성됩니다.

 


<iframe id="embeded-content" width="90%" height="800" frameborder="0" marginwidth="0" scrolling="no" src="경로주소"></iframe>

반응형

'프로그래밍 > Javascript' 카테고리의 다른 글

아이프레임에 높이가 바뀌는 제로보드xe 게시판 넣기  (1) 2016.02.05
셀렉트 박스 링크 걸기  (0) 2016.01.30
eval()  (0) 2015.11.21
for 문 -- 별 삼각형 출력하기  (0) 2015.10.14
switch 문  (0) 2015.10.11

+ Recent posts