MediaQueryListEvent.MediaQueryListEvent()

The MediaQueryListEvent constructor creates a new MediaQueryListEvent instance.

Syntax

var myMqlEvent = new MediaQueryListEvent(init);

Parameters

init

An init object that defines features of the new object instance. The available properties are:

  • media: A DOMString representing a serialized media query.
  • matches: A Boolean representing the media query status — true if it matches, false if not.

Examples

var media = '(max-width: 600px)';
var matches = true;

var myMediaQueryListEvent = new MediaQueryListEvent({media, matches});

Specifications

Specification Status Comment
CSS Object Model (CSSOM) View Module
The definition of 'MediaQueryListEvent()' in that specification.
Working Draft Initial definition

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes ?55 No Yes ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No Yes ?55 Yes ? Yes

See also

Document Tags and Contributors

Contributors to this page: fscholz, chrisdavidmills
Last updated by: fscholz,