이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 함께 해서 번역을 마치도록 도와 주세요!
Summary
Returns a new MediaQueryList
object representing the parsed results of the specified media query string.
Syntax
mql = window.matchMedia(mediaQueryString)
where mediaQueryString
is a string representing the media query for which to return a new MediaQueryList
object.
Example
if (window.matchMedia("(min-width: 400px)").matches) { /* the viewport is at least 400 pixels wide */ } else { /* the viewport is less than 400 pixels wide */ }
This code lets you handle things differently when the window is very narrow.
See Using media queries from code for additional examples.
Specifications
Specification | Status | Comment |
---|---|---|
CSS Object Model (CSSOM) View Module The definition of 'Window.matchMedia()' in that specification. |
Working Draft | Initial definition |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 9 | 6.0 (6.0) | 10 | 12.1 | 5.1 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 3.0 | 6.0 (6.0) | No support | 12.1 | 5 |
See also
문서 태그 및 공헌자
태그:
이 페이지의 공헌자:
Sebastianz,
jswisher,
chuck,
fscholz,
cpigat,
teoli,
libreGeekingKid,
Sheppy,
RudolphGottesheim,
kohei.yoshino,
webinista,
ethertank,
Sir_Pepe,
Marcoos,
leaverou,
robflaherty,
Kohei,
paul.irish
최종 변경:
Sebastianz,