Last active
July 22, 2019 18:16
-
-
Save oliverll1/14200bfbcf295b5f2db0ce10bda962c1 to your computer and use it in GitHub Desktop.
Handle Media queries in Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isMobile = window.matchMedia("only screen and (max-width: 768px)").matches; | |
if (isMobile) { | |
console.log("You are on mobile!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment