JavaScript Window matchMedia()
JavaScript Window matchMedia()
The matchMedia() method is used to return a MediaQueryList with the results from the query. The media queries of the matchMedia() method is any media features of the CSS @media rule. It may include min-height, max-height, etc.
Syntax:-
Its syntax is:- window.matchMedia(mediaQuery)
Return:-
Its return is:- MediaQueryList object with the results of the media query
Further Explanation:-
Parameter | Description |
mediaQuery | Required. A string representing a media query. |