MediaQueryList.matches

La propiedad matches de s贸lo lectura de la interfaz MediaQueryList es Boolean (en-US) que devuelve true si el document coincide actualmente con el medio lista de consultas, o false si no.

Sintaxis

var matches = MediaQueryList.matches;

Value

A Boolean (en-US); returns true if the document currently matches the media query list, false if not.

Examples

var mql = window.matchMedia('(max-width: 600px)');

if(mql.matches) {
  // media query test returning true
}

Specifications

Specification Status Comment
CSS Object Model (CSSOM) View Module
La definici贸n de 'matches' en esta especificaci贸n.
Working Draft Initial definition

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 9 (Yes) 6.0 (6.0) 10 12.1 5
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support ? (Yes) ? ? ? ? ?

See also