Window.resizeTo()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Window.resizeTo()
메서드는 동적으로 창의 크기를 변경합니다.
구문
js
window.resizeTo(width, height);
매개변수
width
-
새로운
outerWidth
를 나타내는 픽셀 단위 정수. 스크롤 바, 제목 표시줄 등을 모두 포함한 너비입니다. height
-
새로운
outerHeight
를 나타내는 픽셀 단위 정수. 스크롤 바, 제목 표시줄 등을 모두 포함한 높이입니다.
예제
다음 함수는 창의 크기를 화면에서 사용 가능한 크기의 1/4로 설정합니다. Screen.availWidth
, Screen.availHeight
속성도 참고하세요.
js
function quarter() {
window.resizeTo(window.screen.availWidth / 2, window.screen.availHeight / 2);
}
명세
Specification |
---|
CSSOM View Module # dom-window-resizeto |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
resizeTo |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.