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="官网">
时间: 2024-11-02 11:19:13