iframe사용시 높이 자동 조정하기 입니다.

· 10년 전 · 295

<script language='JavaScript' type='text/javascript'>
function resizeFrame(iframeObj){
        var innerBody = iframeObj.contentWindow.document.body;
        oldEvent = innerBody.onclick;
        innerBody.onclick = function(){ resizeFrame(iframeObj, 1);oldEvent; };

        var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
         iframeObj.style.height = innerHeight;

        if( !arguments[1] )        /* 특정 이벤트로 인한 호출시 스크롤을 그냥 둔다. */
                this.scrollTo(1,1);
}
</script>

<iframe width=600 height=600 src="내용의경로" onload="resizeFrame(this)"  frameborder=0></iframe>

|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

팁게시판

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
10년 전 조회 194
10년 전 조회 213
10년 전 조회 178
10년 전 조회 229
10년 전 조회 236
10년 전 조회 281
10년 전 조회 198
10년 전 조회 215
10년 전 조회 382
10년 전 조회 228
10년 전 조회 278
10년 전 조회 259
10년 전 조회 296
10년 전 조회 407
10년 전 조회 280
10년 전 조회 245
10년 전 조회 266
10년 전 조회 374
10년 전 조회 284
10년 전 조회 237
10년 전 조회 239
10년 전 조회 247
10년 전 조회 201
10년 전 조회 204
10년 전 조회 381
🐛 버그신고