<html>
<body>
<p>Click the button to find out if the screen/viewport is less than or greater than 700 pixels wide.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("demo");
if (window.matchMedia("(max-width: 700px)").matches) {
x.innerHTML = "The screen is less than, or equal to, 700 pixels wide.";
} else {
x.innerHTML = "The screen is at least 700 pixels wide.";
}
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_matchmedia by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:04:10 GMT -->
</html>