Using media queries from code | Document Object Model (DOM) | MDN
▻https://developer.mozilla.org/en-US/docs/DOM/Using_media_queries_from_code?redirectlocale=en-US&redirectslug=C
Jouer avec les media queries depuis un script, par exemple :
var mq = window.matchMedia("(max-width: 640px)");
if (!mq.matches)
alert('prout');
The DOM provides features that make it possible to test the results of a media query programmatically. This is done using the MediaQueryList interface and its methods and properties. Once you’ve created a MediaQueryList object, you can check the result of the query or, alternatively, receive notifications automatically when the result changes.