This feature is outdated. The MediaQueryList.addListener() callback is now a plain function and called with the standard MediaQueryListEvent object.
A MediaQueryList
object maintains a list of media queries on a 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 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 MediaQueryList
for which the evaluated result changed.
Syntax
function( mediaQueryList ) { ... }
Parameters
mediaQueryList
- The
MediaQueryList
instance.
Specifications
Specification | Status | Comment |
---|---|---|
CSS Object Model (CSSOM) View Module The definition of 'MediaQueryListListener' in that specification. |
Working Draft | Initial definition |
Browser compatibility
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.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
MediaQueryListListener | Chrome ? | Edge Full support ≤18 | Firefox Full support 6 | IE ? | Opera ? | Safari ? | WebView Android ? | Chrome Android ? | Firefox Android ? | Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown