From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- files/ko/web/api/window/matchmedia/index.html | 77 +++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 files/ko/web/api/window/matchmedia/index.html (limited to 'files/ko/web/api/window/matchmedia') diff --git a/files/ko/web/api/window/matchmedia/index.html b/files/ko/web/api/window/matchmedia/index.html new file mode 100644 index 0000000000..224edecbd1 --- /dev/null +++ b/files/ko/web/api/window/matchmedia/index.html @@ -0,0 +1,77 @@ +--- +title: Window.matchMedia() +slug: Web/API/Window/matchMedia +tags: + - API + - CSSOM View + - JavaScript + - Media Queries + - Method + - Reference +translation_of: Web/API/Window/matchMedia +--- +
{{APIRef}}
+ +

Window.matchMedia() 메서드는 주어진 미디어 쿼리 문자열의 분석 결과를 나타내는 {{domxref("MediaQueryList")}} 객체를 반환합니다.

+ +

구문

+ +
window.matchMedia(mediaQueryString)
+ +

매개변수

+ +
+
mediaQueryString
+
분석할 미디어 쿼리를 나타내는 문자열.
+
+ +

반환 값

+ +

주어진 미디어 쿼리에 대한 {{domxref("MediaQueryList")}} 객체,

+ +

예제

+ +

다음 예제는 화면이 매우 좁을 때 다른 작업을 수행합니다.

+ +
if (window.matchMedia("(min-width: 400px)").matches) {
+  /* 뷰포트 너비가 400 픽셀 이상 */
+} else {
+  /* 뷰포트 너비가 400 픽셀 미만 */
+}
+
+ +

더 많은 예제는 Testing media queries programmatically를 참고하세요.

+ +

명세

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName("CSSOM View", "#dom-window-matchmedia", "Window.matchMedia()")}}{{Spec2("CSSOM View")}}Initial definition
+ +

브라우저 호환성

+ + + +

{{Compat("api.Window.matchMedia")}}

+ +

같이 보기

+ + -- cgit v1.2.3-54-g00ecf