// This works if the browser does NOT support the addListener and removeListener. DrupalMatchMedia('screen and (min-width: 28em)').addListener(function (mql) { console.log(mql); console.log(mql.media + ': ' + mql.matches) }); DrupalMatchMedia('screen and (max-width: 28em)').addListener(function (mql) { console.log(mql.media + ': ' + mql.matches) }); // This doesn't work for some reason. matchMedia('screen and (min-width: 28em)').addListener(function (mql) { alert('dit doet blijkbaar niets') }); DrupalMatchMedia('screen and (max-width: 28em)').addListener(function (mql) { alert('en dit ook niet...'); });