MediaQueryList Class
A media query list whose state can be observed (https://drafts.csswg.org/cssom-view/#the-mediaquerylist-interface), created by Window.MatchMedia.
public sealed class MediaQueryList : EventTargetRemarks
The media query list is evaluated against the environment of its document (see ViewportOptions; the viewport of a nested browsing context is the size of its iframe). The change events are fired when the event loop updates the rendering (e.g. before the animation frame callbacks), as specified.
See also
- Inheritance
EventTargetMediaQueryList
Properties
| Name | Description |
|---|---|
| Matches | Gets whether the media query list matches the environment of the document (https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-matches). |
| Media | Gets the serialized media query list (https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-media). |
| OnChange | Gets or sets the event handler of the change event. |
Matches
MediaQueryList.csGets whether the media query list matches the environment of the document (https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-matches).
public bool Matches { get; }Media
MediaQueryList.csGets the serialized media query list (https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-media).
public string Media { get; }OnChange
MediaQueryList.csGets or sets the event handler of the change event.
Property value
See also
Methods
| Name | Description |
|---|---|
| AddListener(IEventListener?) | Adds a listener of the change events (https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-addlistener). |
| AddListener(Action<Event>?) | Adds a listener of the change events (https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-addlistener). |
| RemoveListener(IEventListener?) | Removes a listener of the change events (https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-removelistener). |
| RemoveListener(Action<Event>?) | Removes a listener of the change events (https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-removelistener). |
AddListener overloads
AddListener(IEventListener?)
MediaQueryList.csAdds a listener of the change events (https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-addlistener).
public void AddListener(IEventListener? callback)AddListener(Action<Event>?)
MediaQueryList.csAdds a listener of the change events (https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-addlistener).
Parameters
callbackAction<Event>?
RemoveListener overloads
RemoveListener(IEventListener?)
MediaQueryList.csRemoves a listener of the change events (https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-removelistener).
public void RemoveListener(IEventListener? callback)RemoveListener(Action<Event>?)
MediaQueryList.csRemoves a listener of the change events (https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-removelistener).
Parameters
callbackAction<Event>?