TAG
JavaScript
Result
Run
License
<h1>Please resize to window.</h1>
window.addEventListener("load", function() { var mql = window.matchMedia("(max-width: 600px)"); mql.addListener(responsive); var evtChange = new Event("change"); mql.dispatchEvent(evtChange); }); function responsive(e) { if (e.matches) { document.body.style.backgroundColor = "#FFFF00"; } else { document.body.style.backgroundColor = "#00FF00"; } }
Console
expand_less
License
License
by DevDic
Close