{{APIRef}}
{{SeeCompatTable}}
A MediaQueryList
object maintains a list of media queries on a {{ domxref("document") }}, and handles sending notifications to listeners when the media queries on the document change.
This makes it possible to observe a document to detect when its media queries change, instead of polling the values periodically, if you need to programmatically detect changes to the values of media queries on a document.
A MediaQueryListListener
is a callback function that gets invoked with a single argument, the {{ domxref("MediaQueryList") }} for which the evaluated result changed.
Browser compatibility
{{ CompatibilityTable() }}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{ CompatUnknown() }} | {{ CompatGeckoDesktop("6.0") }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
Specification
See also
- Media queries
- Using media queries from code
- {{ domxref("MediaQueryList") }}
- {{ domxref("window.matchMedia()") }}