Last active
December 15, 2015 15:09
-
-
Save ozinepank/5279365 to your computer and use it in GitHub Desktop.
Detect User agent
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
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { | |
$(".body-section").addClass("app-visible"); | |
/* | เมื่อ user เปิดเว็บผ่าน iPhone/iPod ให้ addClass .app-visible เข้าไปใน body-section | */ | |
// credit : http://davidwalsh.name/detect-iphone | |
IS_IPAD = navigator.userAgent.match(/iPad/i) != null; | |
IS_IPHONE = (navigator.userAgent.match(/iPhone/i) != null) || (navigator.userAgent.match(/iPod/i) != null); | |
IS_android = navigator.userAgent.match(/Android/i) != null; | |
if (IS_IPAD || IS_IPHONE || IS_android) { | |
// สร้าง function project ตัวเองตรงนี้// | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment