Skip to content

Instantly share code, notes, and snippets.

@ozinepank
Last active December 15, 2015 15:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozinepank/5279365 to your computer and use it in GitHub Desktop.
Save ozinepank/5279365 to your computer and use it in GitHub Desktop.
Detect User agent
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