Last active
May 9, 2018 20:07
-
-
Save marciofmjr/ea40513d5f70f9732d408cda0394d97a to your computer and use it in GitHub Desktop.
Javascript function to verify if breakpoint is mobile or not based on css
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
function isMobile(){ | |
var content = window.getComputedStyle(document.querySelector('body'), ':before').getPropertyValue('content'); | |
if(content == "\"mobile\"" || content == "mobile"){ | |
return true; | |
}else{ | |
return false; | |
} | |
} |
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
+bp-mobile // or mobile breakpoint | |
body:before | |
display: block | |
width: 1px | |
height: 1px | |
overflow: hidden | |
opacity: 0 | |
color: transparent | |
position: absolute | |
content: "mobile" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment