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