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.
Une fourberie pour faire la même chose à coup de css + jQuery :
Rather than the measuring the screen width on resize of the window, I check for a css rule that is changed by the media query. This way, regardless of the how the browser treats the scrollbar, the media query will fire at the same time.