码迷,mamicode.com
首页 > 移动开发 > 详细

手机项目常用知识小记

时间:2015-04-08 10:52:11      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:

1.用pc的思路做mobile,写死页面宽度

<meta name="viewport" content="width=640,target-densitydpi=320,user-scalable=no" />

2.改变jquery mobile滑动初始值

$.event.special.swipe.horizontalDistanceThreshold = 10;

3.判断是否为微信内置浏览器

function is_weixin(){
        var ua = navigator.userAgent.toLowerCase();
        if(ua.match(/MicroMessenger/i)=="micromessenger") {
            return true;
        } else {
            return false;
        }
    }

4.判断浏览器类型

function isBrowser(){
        var Sys={};
        var ua=navigator.userAgent.toLowerCase();
        var s;
        (s=ua.match(/msie ([\d.]+)/))?Sys.ie=s[1]:
        (s=ua.match(/firefox\/([\d.]+)/))?Sys.firefox=s[1]:
        (s=ua.match(/chrome\/([\d.]+)/))?Sys.chrome=s[1]:
        (s=ua.match(/opera.([\d.]+)/))?Sys.opera=s[1]:
        (s=ua.match(/version\/([\d.]+).*safari/))?Sys.safari=s[1]:0;

        if(Sys.safari){
            //
        }
    }

5.ios添加主屏幕图标

<link rel="apple-touch-icon-precomposed" sizes="144x144" href="http://*/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="http://*/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://*/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon-precomposed" href="*/apple-touch-icon-57x57.png">
<meta name="apple-mobile-web-app-title" content="官网">

 

手机项目常用知识小记

标签:

原文地址:http://www.cnblogs.com/bianyuan/p/4401644.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!