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)The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
AddEventListener(string, DOMEventHandler, bool)The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
AddEventListener(string, IEventListener, bool)The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
AddListener(IEventListener)Add MediaQueryList matches state change event listener.
DispatchEvent(Event)Dispatches an Event at the specified EventTarget, (synchronously) invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
virtual GetPlatformType()This method is used to retrieve the ECMAScript object .
RemoveEventListener(string, IEventListener)This method allows the removal of event listeners from the event target. If an is removed from an 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 is removed from an 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 is removed from an 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