This feature is outdated. The MediaQueryList.addListener() callback is now a plain function and called with the standard MediaQueryListEvent 对象。

A MediaQueryList object maintains a list of media queries 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.

句法

function( mediaQueryList ) { ... }
					

参数

mediaQueryList
MediaQueryList 实例。

规范

规范 状态 注释
CSSOM (CSS 对象模型) 视图模块
The definition of 'MediaQueryListListener' in that specification.
工作草案 初始定义

浏览器兼容性

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.

更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
MediaQueryListListener Chrome ? Edge ≤18 Firefox 6 IE ? Opera ? Safari ? WebView Android ? Chrome Android ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?

图例

完整支持

完整支持

兼容性未知 ?

兼容性未知

另请参阅

元数据

  • 最后修改: