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개
게시글 목록
| 번호 | 제목 |
|---|---|
| 24318 | |
| 24317 | |
| 24315 | |
| 24309 | |
| 24294 | |
| 24293 | |
| 24277 | |
| 24262 | |
| 24260 | |
| 24253 | |
| 24251 | |
| 24236 | |
| 24233 | |
| 24228 | |
| 24226 | |
| 24221 | |
| 24214 | |
| 24203 | |
| 24201 | |
| 24199 | |
| 24196 | |
| 24195 | |
| 24194 | |
| 24192 | |
| 24191 | |
| 24187 | |
| 24185 | |
| 24183 | |
| 24172 | |
| 24168 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기