MediaQueryList Class

MediaQueryList class

A MediaQueryList object stores information on a media query applied to a document, with support for both immediate and event-driven matching against the state of the document. See CSSOM View Module specification: https://www.w3.org/TR/cssom-view/#the-mediaquerylist-interface

public class MediaQueryList : EventTarget

Properties

NameDescription
Document { get; }Context object’s associated document.
Matches { get; }A boolean value that returns true if the document currently matches the media query list, or false if not.
Media { get; }A string representing a serialized media query.

Methods

NameDescription
AddEventListener(string, IEventListener)This method allows the registration of event listeners on the event target.
AddEventListener(string, DOMEventHandler, bool)This method allows the registration of event listeners on the event target.
AddEventListener(string, IEventListener, bool)This method allows the registration of event listeners on the event target.
AddListener(IEventListener)Add MediaQueryList matches state change event listener.
DispatchEvent(Event)This method allows the dispatch of events into the implementations event model.
Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
virtual GetPlatformType()This method is used to retrieve ECMAScript object Type.
RemoveEventListener(string, IEventListener)This method allows the removal of event listeners from the event target. If an IEventListener is removed from an EventTarget while it is processing an event, it will not be triggered by the current actions. Event Listeners can never be invoked after being removed.
RemoveEventListener(string, DOMEventHandler, bool)This method allows the removal of event listeners from the event target. If an IEventListener is removed from an EventTarget while it is processing an event, it will not be triggered by the current actions. Event Listeners can never be invoked after being removed.
RemoveEventListener(string, IEventListener, bool)This method allows the removal of event listeners from the event target. If an IEventListener is removed from an EventTarget while it is processing an event, it will not be triggered by the current actions. Event Listeners can never be invoked after being removed.
RemoveListener(IEventListener)Remove MediaQueryList matches state change event listener.

Events

NameDescription
event OnChangeEvent that is fired at the MediaQueryList when the matches state changes.

See Also