pc 크롬에서 풀스크린 원버튼 명령어
[code]
document.fullscreenElement ? document.exitFullscreen() : 엘레먼트ID.requestFullscreen();
[/code]
예제
[code]
<div id="g5" style="width:500px;margin:0 auto">
<img style="width:100%" src="https://blog.kakaocdn.net/dn/dGvqOG/btrcONHUaWw/cvKSoMdobz8gmS3ubZTYcK/img.jpg">
<span style="position:absolute;top:20px;left:20px;cursor:pointer" onclick="document.fullscreenElement?document.exitFullscreen():g5.requestFullscreen()">클릭</span>
</div>
[/code]
이런 건 여러번을 사용할 경우 "함수"를 만드는 것이 편합니다.
[code]
<script>
function fsMode(fs) {
document.fullscreenElement ? document.exitFullscreen() : fs.requestFullscreen();
}
</script>
<div id="g5" style="width:500px;margin:0 auto">
<img style="width:100%" src="https://blog.kakaocdn.net/dn/dGvqOG/btrcONHUaWw/cvKSoMdobz8gmS3ubZTYcK/img.jpg">
<span style="position:absolute;top:20px;left:20px;cursor:pointer" onclick="fsMode(g5)">클릭</span>
</div>
[/code]
결과물은 https://wittazzurri.com/editor/html_editor.php 에서 확인해 보세요.
사파리나 파폭은 사용 안해서 잘 모르고 관심도 없음.ㅜㅠ
댓글 6개
게시글 목록
| 번호 | 제목 |
|---|---|
| 24149 | |
| 24140 | |
| 24133 | |
| 24125 | |
| 24119 | |
| 24109 | |
| 24105 | |
| 24101 | |
| 24093 | |
| 24089 | |
| 24077 | |
| 24074 | |
| 24071 | |
| 24070 | |
| 24067 | |
| 24056 | |
| 24050 | |
| 24046 | |
| 24043 | |
| 24040 | |
| 24037 | |
| 24036 | |
| 24035 | |
| 24034 | |
| 24021 | |
| 24017 | |
| 24005 | |
| 24002 | |
| 23990 | |
| 23980 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기