Created
September 5, 2014 05:23
-
-
Save YamilG/dc8b2ff5ba5f757ba536 to your computer and use it in GitHub Desktop.
Check if mobile
This file contains hidden or 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
var sw = document.body.clientWidth, | |
sh = document.body.clientHeight, | |
breakpoint = 650, | |
mobile = true; | |
$(document).ready(function() { | |
checkMobile(); | |
}); | |
$(w).resize(function(){ | |
sw = document.body.clientWidth; | |
sh = document.body.clientHeight; | |
checkMobile(); | |
}); | |
function checkMobile() { | |
mobile = (sw > breakpoint) ? false : true; | |
if (!mobile) { | |
// if not mobile | |
} else { | |
// or else... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment