# Fullscreen
##### [source : https://jsfiddle.net/softm/ey9dewj9/ ](https://jsfiddle.net/softm/ey9dewj9/)
```html
```
```css
```
```javascript
// full-screen available?
if (
document.fullscreenEnabled ||
document.webkitFullscreenEnabled ||
document.mozFullScreenEnabled ||
document.msFullscreenEnabled
) {
// image container
var i = document.getElementById("myimage");
// click event handler
i.onclick = function() {
// in full-screen?
if (
document.fullscreenElement ||
document.webkitFullscreenElement ||
document.mozFullScreenElement ||
document.msFullscreenElement
) {
// exit full-screen
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
}
else {
// go full-screen
if (i.requestFullscreen) {
this.requestFullscreen();
} else if (i.webkitRequestFullscreen) {
i.webkitRequestFullscreen();
} else if (i.mozRequestFullScreen) {
i.mozRequestFullScreen();
} else if (i.msRequestFullscreen) {
i.msRequestFullscreen();
}
}
}
}
```
HTML5 Full-Screen Demonstration
'web > javascript' 카테고리의 다른 글
Node.js-Express (0) | 2019.07.22 |
---|---|
Node.js (0) | 2019.07.21 |
jquery model dialog box (0) | 2019.07.18 |
d3 data return (0) | 2019.07.17 |
d3js - enter(), update() and exit() (0) | 2019.07.16 |
댓글