移动web app开发小贴士,移动开发经验记录
2015-02-10 12:10
423 查看
解决300ms的延迟
a、用zepto的tap事件,但不兼容pcb、用fastclick
c、tappy
d、touchjs
阻止弹性滚动
<script> functionBlockMove(event){ //Tell Safari not to move the window. event.preventDefault(); } </script> <body ontouchmove="BlockMove(event);"> ... </body>
检测屏幕是否旋转
//Detect whether device supports orientationchange event, otherwise fall back to //the resize event. varsupportsOrientationChange="onorientationchange"inwindow, orientationEvent=supportsOrientationChange?"orientationchange":"resize"; window.addEventListener(orientationEvent,function(){ alert('HOLY ROTATING SCREENS BATMAN:'+window.orientation+" "+screen.width); },false);
禁止webapp跳转到safari(for ios)
// Mobile Safari in standalone mode if(("standalone"inwindow.navigator)&&window.navigator.standalone){ // If you want to prevent remote links in standalone web apps opening Mobile Safari, change 'remotes' to true varnoddy, remotes=false; document.addEventListener('click',function(event){ noddy=event.target; //Bubble up until we hit link or top HTML element. Warning: BODY element is not compulsory so better to stop on HTML while(noddy.nodeName!=="A"&&noddy.nodeName!=="HTML"){ noddy=noddy.parentNode; } if('href'innoddy&&noddy.href.indexOf('http')!==-1&&(noddy.href.indexOf(document.location.host)!==-1||remotes)){ event.preventDefault(); document.location.href=noddy.href; } },false); }
阻止旋转屏幕时自动调整字体大小
-webkit-text-size-adjust:none;
IOS中禁止用户选中文字
-webkit-user-select:none;
iOS中如何禁止用户保存图片 复制图片
-webkit-touch-calloutt:none;
语音输入
<input type="text"x-webkit-speech />
文件上传, 从相机捕获媒体
<input type="file"accept="image/*; capture=camera" /> <input type="file"accept="video/*; capture=camcorder" /> <input type="file"accept="audio/*; capture=microphone" />
发送短信给多个人
<a href="sms:18888886666,18888885555"> 发送短信给多个人
相关文章推荐
- 移动web app开发小贴士 收藏有用
- ASP.NET 移动开发一点经验
- PHP:SMS移动短信接口二次开发中的插入多行记录操作(含实时进度显示)
- 开通技术博客啦,记录开发经验!
- 聊一聊我在移动平台混合开发的经验
- 实践者谈移动开发中的web app、native app和hybrid app
- 移动web app开发——JO、 jQ mobile和Sencha touch技术对比
- 开发经验记录, 设计的蝴蝶引起的代码地震, 小品文.
- 移动开发经验分享
- 移动web app开发-----application cache 离线缓存(进阶)
- 聊一聊我在移动平台混合开发的经验
- J2ME手机移动通讯开发记录存储管理系统的例子
- 移动互联网创业团队开发管理经验
- 移动互联网创业团队开发管理经验
- 移动web app开发-----调试篇
- Android上OpenGL开发一些经验记录(上)
- AS/400开发经验点滴(七)在RPG程序中巧用相对记录号RRN
- 移动(c/s)项目开发经验
- 移动web app开发-----application cache 离线缓存原理篇
- 开发Web App的一些工具和经验总结