diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
commit | da78a9e329e272dedb2400b79a3bdeebff387d47 (patch) | |
tree | e6ef8aa7c43556f55ddfe031a01cf0a8fa271bfe /files/ko/web/api/window/matchmedia | |
parent | 1109132f09d75da9a28b649c7677bb6ce07c40c0 (diff) | |
download | translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.gz translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.bz2 translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.zip |
initial commit
Diffstat (limited to 'files/ko/web/api/window/matchmedia')
-rw-r--r-- | files/ko/web/api/window/matchmedia/index.html | 77 |
1 files changed, 77 insertions, 0 deletions
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 +--- +<div>{{APIRef}}</div> + +<p><strong><code>Window.matchMedia()</code></strong> 메서드는 주어진 <a href="/ko/docs/Web/Guide/CSS/Media_queries">미디어 쿼리</a> 문자열의 분석 결과를 나타내는 {{domxref("MediaQueryList")}} 객체를 반환합니다.</p> + +<h2 id="Syntax" name="Syntax">구문</h2> + +<pre class="syntaxbox">window.matchMedia(<em>mediaQueryString</em>)</pre> + +<h3 id="매개변수">매개변수</h3> + +<dl> + <dt><code>mediaQueryString</code></dt> + <dd>분석할 미디어 쿼리를 나타내는 문자열.</dd> +</dl> + +<h3 id="반환_값">반환 값</h3> + +<p>주어진 미디어 쿼리에 대한 {{domxref("MediaQueryList")}} 객체,</p> + +<h2 id="Example" name="Example">예제</h2> + +<p>다음 예제는 화면이 매우 좁을 때 다른 작업을 수행합니다.</p> + +<pre class="brush: js">if (window.matchMedia("(min-width: 400px)").matches) { + /* 뷰포트 너비가 400 픽셀 이상 */ +} else { + /* 뷰포트 너비가 400 픽셀 미만 */ +} +</pre> + +<p>더 많은 예제는 <a href="/ko/docs/Web/CSS/Media_Queries/Testing_media_queries">Testing media queries programmatically</a>를 참고하세요.</p> + +<h2 id="명세">명세</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName("CSSOM View", "#dom-window-matchmedia", "Window.matchMedia()")}}</td> + <td>{{Spec2("CSSOM View")}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">브라우저 호환성</h2> + + + +<p>{{Compat("api.Window.matchMedia")}}</p> + +<h2 id="See_also" name="See_also">같이 보기</h2> + +<ul> + <li><a href="/ko/docs/Web/Guide/CSS/Media_queries">미디어 쿼리 사용하기</a></li> + <li><a href="/en-US/docs/DOM/Using_media_queries_from_code" title="CSS/Using media queries from code">Using media queries from code</a></li> + <li>{{domxref("MediaQueryList")}}</li> + <li>{{domxref("MediaQueryListListener")}}</li> +</ul> |