웹페이지 전체화면 적용/해제

페이지 정보

profile_image
작성자 LJM
댓글 0건 조회 46회 작성일 19-04-01 09:20

본문

<span id="FullScreenID" onclick="toggleFullScreen();" style="cursor:pointer;font-size:1.7em;padding-right:10px;color:#B9B9B9;"><i class="xi-expand-square"></i></span>

 

<script>

function toggleFullScreen() {

 

var doc = window.document;

var docEl = doc.documentElement;

 

var requestFullScreen = docEl.requestFullscreen || docEl.mozRequestFullScreen || docEl.webkitRequestFullScreen || docEl.msRequestFullscreen;

var cancelFullScreen = doc.exitFullscreen || doc.mozCancelFullScreen || doc.webkitExitFullscreen || doc.msExitFullscreen;

 

if(!doc.fullscreenElement && !doc.mozFullScreenElement && !doc.webkitFullscreenElement && !doc.msFullscreenElement) {

requestFullScreen.call(docEl);

$("#FullScreenID").children('i').removeClass('xi-expand-square');

$("#FullScreenID").children('i').addClass('xi-compress-square');

} else {

cancelFullScreen.call(doc);

$("#FullScreenID").children('i').removeClass('xi-compress-square');

$("#FullScreenID").children('i').addClass('xi-expand-square');

}

}

</script>

댓글목록

등록된 댓글이 없습니다.

로그인